Free Support Forum -

Replacing Outlook Redemption with Aspose.Email

Can Aspose.Email for .NET replace this code using Outlook Redemption to get the SMTPAddress:

Application outlookApp = ETrayOutlook.GetInstance().OutlookApplication;

var rdoSession = new RDOSession { MAPIOBJECT = outlookApp.Session.MAPIOBJECT };

string filePath = ETrayFile.CreateTempFileCopy(file.CurrentFilePath);

mailItem = (MailItem)outlookApp.CreateItemFromTemplate(filePath, Missing.Value);


MAPIFolder draftFolder = outlookApp.Session.GetDefaultFolder(OlDefaultFolders.olFolderDrafts);

RDOMail rdoMail = rdoSession.GetMessageFromID(mailItem.EntryID, draftFolder.StoreID, null);

tbTo.Text = rdoMail.Sender.SMTPAddress;

Med venlig hilsen / Best regards

Martin Herløv Andersen

Senior Software Engineer


Mobil: +45 2426 4557

Hi Med venlig hilsen,

Thanks for writing to Aspose.Email support team.

I have analyzed the information and tried to compile and execute the provided sample code. I am afraid to inform that I could not execute the code and observe the output.

To proceed further, I need to understand the functionality and output of this code, so that I may assist you to perform the same task using Aspose.Email. Please provide more detail as follows:

1. What steps are performed in this code?
2. Is it extracting and saving a message to the disk and then extracting the SmtpAddress from this saved message.
3. Also any other details, sample console application project or other information will be an add on to understand the requirement and provide solution.

Thanks for your cooperation in advance.

I found a solution

var mapiMsg = MapiMessage.FromFile(testFile);
var mapisender = new MailAddress(mapiMsg.Headers[“From”]);
string sAddress = mapiMsg.TryGetPropertyString(MapiPropertyTag.PR_SENDER_EMAIL_ADDRESS);

Hi Med venlig hilsen,

Thanks for sharing the update and we are glad to know that your issue is resolved. Please feel free to write us if you have any other query in this regard.