4

I am sending an email to alias@company.com which is an alias to a real mailbox address. I then connect to the real mailbox (let's say realmailbox@company.com) using MailKit and retrieve messages. When I inspect the To address, all I see is the realmailbox@company.com. How to I see the original alias address that the email was sent to?

For example:

var fullMessage = imapClient.Inbox.GetMessage(uid);
var recipients = fullMessage.To;

recipients only show the realmailbox@company.com, not the alias@company.com.

Hai Vu
  • 41
  • 5

1 Answers1

1

It sounds to me like your SMTP server is performing a string substitution on the alias before passing it along to the recipient mailbox making it impossible to get the info you are looking for.

jstedfast
  • 35,744
  • 5
  • 97
  • 110
  • 1
    That is where I got confused as well. If I connect to the same mailbox using Outlook and open up the message, then go to "File -> Properties -> Internet headers", I am able to see the To email in the form "realmailbox ". It shows me both the realmailbox and also the alias as well. Is Outlook doing something special to show the alias? Am I able to achieve something similar using MailKit? Thanks for the reply by the way. – Hai Vu May 12 '17 at 00:08
  • 1
    You'd have to show me the raw To header of the message you got over IMAP for me to say. – jstedfast May 12 '17 at 00:09
  • We are using Exchange Office365 for additional info. – Hai Vu May 12 '17 at 00:22
  • Are you using MailboxAddress.Name? Or MailboxAddress.Address? – jstedfast May 12 '17 at 00:24
  • There is an image in this [link](https://blogs.office.com/2013/08/21/a-better-way-to-manage-aliases-and-primary-email-address-for-your-microsoft-account/) which shows the setup of the email and alias from O365. – Hai Vu May 12 '17 at 00:42
  • It is being setup as follows: Primary email address and user name realmailbox@company.com To change the primary email address, add an alias and set it as primary. This will also change the current user name. Aliases An alias is another email address that people can use to email realmailbox. Alias @ Add Alias1@company.com Set as primary alias2@company.com Set as primary alias3@company.com Set as primary Save Cancel – Hai Vu May 12 '17 at 00:44
  • Just an update to this. I tested this against GMail and the alias is showing fine when the email is retrieved by MailKit. So at this stage, I can only conclude that it is something to do with the O365 server. – Hai Vu May 15 '17 at 01:57
  • @HaiVu did you solve it eventually? I have the same problem. – Steffen Bauer Apr 22 '21 at 11:45
  • 1
    @SteffenBauer. No I don't think so. It has been a long time ago. But I think we went with a work around by avoid using aliases and also create emails from Google instead of O365. – Hai Vu Apr 26 '21 at 10:37
  • 1
    @HaiVu thanks for the update. I switched to EWS where i can get the alias. But its not a native function. I have to manually request and process the raw mail header. – Steffen Bauer Apr 26 '21 at 11:02