Saving Send mails

Hi,

I had purchaced Aspose.net for .NET.

Currently i am able to access the emails from inbox and save to a specified location.

I would like to know one thing. how can i save send email to a specified folder or disc.

Thanks and Regards

Binoy

Hi Binoy,

Saving emails from “Sent Items” folder is not possible using Pop3Client class, because Pop3 protocol only sees the messages in “Inbox” folder.

But, if your mail server supports Imap protocol, it is possible to get messages from different folders. Could you please test the below code to check which folders are listed, in case Imap is supported by your email server?

ImapClient client = new ImapClient(“mail.server.address”, 143, “email”, “pwd”);
client.Connect(true);
ImapFolderInfoCollection folderInfoColl = client.ListFolders();
foreach (ImapFolderInfo folderInfo in folderInfoColl)
{
Console.WriteLine("Folder Name: " + folderInfo.Name);
}
client.Disconnect();

Hi Saqib,

Thanks for the reply. My issue bit different… i am using smtp client to send email. so after sending email how can i save that mail?? my email server supports IMAP.

Thanks and Regards
Binoy

Hi Binoy,

If you are using Aspose.Network.Mail.SmtpClient class, then you may use SmtpClient.Send(MailMessage) method to send email. And use the MailMessage.Save() method to save the message in your specified location.

MailMessage msg = new MailMessage("from@domain.com", "to@domain.com");
SmtpClient client = new SmtpClient(“host”, port, “email”, “pwd”);
client.Send(msg); // send email
msg.Save(“test.msg”, MailMessageSaveType.OutlookMessageFormat); // save email