userTokenField example?


Can the userTokenField parameter be used to alter the body of a mail message in a Merge operation? I’d like to insert a unique url in the body of the message for each recipeint. Any examples or thoughts on how to accomplish this? Thanks.



Thanks for considering Aspose.Network

If you wanna insert a unique url in the body of the message for each recipient, please try our Mail Merge operation. Mail Merge can create a batch of similar mails:


//Create mail message template
Aspose.Network.Mail.MailMessage msg;
msg = new Aspose.Network.Mail.MailMessage();
msg.From = new Aspose.Network.Mail.MailAddress("");
msg.Subject = "Hi, ##name##!";
Aspose.Network.Mail.TextPlainBody plainBody = new Aspose.Network.Mail.TextPlainBody();
plainBody.Content = "Hello, ##name##! \n please visit ##url## \n thank you!.";
msg.Body = plainBody;

//Defined the DataTable
System.Data.DataTable dt;
dt = new System.Data.DataTable();
dt.Columns.Add("AddrTo", typeof(string));
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("url", typeof(string));

dt.Rows.Add(new object[]{
""} );
dt.Rows.Add(new object[]{
dt.Rows.Add(new object[]{
//SmtpClient perform the mail merge and bulk send
Aspose.Network.Mail.SmtpClient mailClient;
mailClient = new Aspose.Network.Mail.SmtpClient("");
mailClient.Merge(msg, new Aspose.Network.Mail.DataTableMerger( dt, "AddrTo", string.Empty, string.Empty, string.Empty ));
catch(Exception ex)
System.Diagnostics.Trace.WriteLine( ex.Message );

Please visit for more info about Mail Merge

Thanks again


Ah. I wasn’t aware of the ##field## notation. Assumed it only worked with email address. Thanks.