|
-
August 5th, 2016, 04:06 AM
#1
Outlook Email Programming in .NET Applications
Using Aspose.Email for .NET - create, read, convert, send and receive Outlook Email MSG, EML, EMLX, PST, OFT and MHT file formats without Microsoft Outlook installed.
Creating and Saving Outlook Messages
Code:
C#
// Create an instance of the MailMessage class
MailMessage mailMsg = new MailMessage();
// Set from, to, subject and body properties
mailMsg.From = txtFrom.Text;
mailMsg.To = txtTo.Text;
mailMsg.Subject = txtSubject.Text;
mailMsg.Body = txtBody.Text;
// Create an instance of the MapiMessage class and pass MailMessage as argument
MapiMessage outlookMsg = MapiMessage.FromMailMessage(mailMsg);
// Path and file name where message file will be saved
string strMsgFile = @"E:\Data\Aspose\temp\sample.msg";
// Save the message (MSG) file
outlookMsg.Save(strMsgFile);
Code:
VB.NET
' Create an instance of the MailMessage class
Dim mailMsg As MailMessage = New MailMessage()
' Set from, to, subject and body properties
mailMsg.From = txtFrom.Text
mailMsg.To = txtTo.Text
mailMsg.Subject = txtSubject.Text
mailMsg.Body = txtBody.Text
' Create an instance of the MapiMessage class and pass MailMessage as argument
Dim outlookMsg As MapiMessage = MapiMessage.FromMailMessage(mailMsg)
' Path and file name where message file will be saved
Dim strMsgFile As String = "E:\Data\Aspose\temp\sample.msg"
' Save the message (MSG) file
outlookMsg.Save(strMsgFile)
Try Aspose.Email APIs to add email capabilities within your ASP.NET Web applications, Web services or Windows applications.
Regards,
Usman Sarfraz
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|