Home > Code > C# > How to Create/Format Forward & Reply Email Messages inside .NET Apps

How to Create/Format Forward & Reply Email Messages inside .NET Apps

by sher azam   on May 11, 2016   Category: C#   |  Views: 1270    |  Points: 25   |  Gold 

This technical tip explains how .NET developers can Create the Forward & Reply Email Messages inside .NET Applications using Aspose.Email for .NET. Aspose.Email API provides the capability of creating and formatting the forward and reply messages. The ReplyMessageBuilder and ForwardMessageBuilder classes of the API are used to create the Reply and Forward messages respectively. A Reply or Forward message can be specified to be created using any of the modes of OriginalMessageAdditionMode enum.

Creating Reply Message

//[C# Code Sample]

MapiMessage originalMsg = MapiMessage.FromFile("original.msg");

ReplyMessageBuilder builder = new ReplyMessageBuilder();
builder.ReplyAll = true;
builder.AdditionMode = OriginalMessageAdditionMode.Textpart;
builder.ResponseText = "<p><b>Dear Friend,</b></p> I want to do is introduce my co-author and co-teacher. <p><a href=\"www.google.com\">This is a first link</a></p><p><a href=\"www.google.com\">This is a second link</a></p>";
MapiMessage replyMsg = builder.BuildResponse(originalMsg);


//[VB.NET Code Sample]

Dim originalMsg As MapiMessage = MapiMessage.FromFile("original.msg")

Dim builder As New ReplyMessageBuilder()
builder.ReplyAll = True
builder.AdditionMode = OriginalMessageAdditionMode.Textpart
builder.ResponseText = "<p><b>Dear Friend,</b></p> I want to do is introduce my co-author and co-teacher. <p><a href=""www.google.com"">This is a first link</a></p><p><a href=""www.google.com"">This is a second link</a></p>"
Dim replyMsg As MapiMessage = builder.BuildResponse(originalMsg)


//Creating Forward Message

//[C# Code Sample]

ForwardMessageBuilder builder = new ForwardMessageBuilder();
builder.AdditionMode = OriginalMessageAdditionMode.Textpart;
MapiMessage forwardMsg = builder.BuildResponse(originalMsg);

//[VB.NET Code Sample]

Dim builder As New ForwardMessageBuilder()
builder.AdditionMode = OriginalMessageAdditionMode.Textpart
Dim forwardMsg As MapiMessage = builder.BuildResponse(originalMsg)

Overview: Aspose.Email for .NET

Aspose.Email for .NET is a set of components allowing developers to easily implement email functionality within their ASP.NET web applications, web services & Windows applications. It Supports Outlook PST, EML, MSG & MHT formats. It allows developers to work with SMTP, POP3, FTP & MS Exchange servers. It supports mail merge, iCalendar, customized header & body, header information, embedded files, Twitter & many more. It makes it easy to work with HTML or plain text emails & their attachments.

- Homepage of Aspose.Email for .NET: http://www.aspose.com/.net/email-component.aspx

- Download Aspose.Email for .NET: http://www.aspose.com/downloads/email-family/net

Post Code  |  Code Snippet Home

User Responses

No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts