Create Book Mark in an Email Message for Automation

I would like to know whether it is possible to use Aspose.Network component to create and access a bookmark or a marker that would allow this to be access in code.

or

Whether someone know any idea how to do this could share some thought would be really appreciated.

1. Create new email from outlook that contain "bookmark".
2. Use Aspose.Network Component to paste the content of the clipboad into the selected bookmark.

What I want to achive is to have an email with predefined format.

[from:]

[specialtext]

[bodytext1]

Signature (Predefined Digital Signature insert by code).

Thanks in Advance.
Regard Dat.

Hi Dat,

Thank you for inquiry.

This can be achieved using mail merge functionality of Aspose.Network. Please visit http://www.aspose.com/documentation/.net-components/aspose.network-for-.net/performing-mail-merge.html for more details.

You may define from, specialtext etc as columns in data table. And same fields can be defined in the HtmlBody of the message. Below is the sample code for your scenario.

First create a new message with pre-defined fields. You may also create such message using Aspose.Network and save it in MSG format and load it later for populating the fields.

//Create a new MailMessage instance
MailMessage msg = new MailMessage();
//Add subject and from address
msg.Subject = “Hello, #FirstName#”;
msg.From = “saqibrazzaq@gmail.com”;
//Add email address to send email
msg.To.Add(new MailAddress(“#Receipt#”, true));
//Add mesage field to html body
msg.HtmlBody = “Hello #FirstName# #LastName#,
Your message here\n”;

Below is the code for populating the template message above with values from DataTable:
//Create a new TemplateEngine with the msg message.
TemplateEngine engine = new TemplateEngine(msg);

//Create an instance of DataTable
//Fill a DataTable as data source
DataTable dt = new DataTable();
dt.Columns.Add(“Receipt”, typeof(string));
dt.Columns.Add(“FirstName”, typeof(string));
dt.Columns.Add(“LastName”, typeof(string));
dt.Columns.Add(“Footer”, typeof(string));

//Create an instance of DataRow
DataRow dr;

dr = dt.NewRow();
dr[“Receipt”] = “from@domain.com”;
dr[“FirstName”] = “Your First Name”;
dr[“LastName”] = “Your Last Name”;
dr[“Footer”] = “tab1\t. tab2\t\n\n\n.4th line.”;
dt.Rows.Add(dr);

// Now use TemplateEngine class. It will fill the template message with above values. You may use multiple rows for creating multiple messages
MailMessageCollection messages;
try
{
Console.WriteLine(“Preparing message…”);
//Create messages from the message and datasource.
messages = engine.Instantiate(dt);
// Save the first message
messages[0].Save(“test.msg”, MailMessageSaveType.OutlookMessageFormat);
Process.Start(“test.msg”);
Console.WriteLine(“Messages sent.”);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}

Thank you, I didn’t have the chance to try it out yet.