We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Friendly name on MailAddress doesn't work when using EWS

Dim client1 As IEWSClient = EWSClient.GetEWSClient(“https://owa.companyabc.com/ews/exchange.asmx”, “srv_email”, “fdderfddf;”, “ABC”)

    client1.ImpersonateUser(ItemChoice.PrimarySmtpAddress, "johnsmith@companyabc.com")

    Dim msg As MailMessage = New MailMessage
    msg.From.Add(New MailAddress("johnsmith@company@abc.com", "John Smith"))
    msg.To.Add(New MailAddress("janejones@gmail.com", "Jane Jones"))
    msg.Subject = "Sending message from exchange server via Aspose (1)"
    msg.HtmlBody = "<h3>Sending message from exchange server via Aspose</h3>"
    client1.Send(msg)

When I execute the above code the email does get sent without error however, the friendly name is ignored and only the first part of the email address (before the @) is shown. Is there something I am missing to get the friendly name to appear?

Thanks,
T.J.

Using Aspose.Email.dll v17.9.0.0

@mscitadmin,

Thank you for contacting Aspose support team.

Could you please send us an image which shows the comparison of expected friendly name result and friendly name in mail sent by Aspose.Email ? It will help us to observe the issue and provide assistance accordingly.

In the recipient’s email list it will show the email as coming from “johnsmith” where I would expect it to come from “John Smith.” And in the sender’s email list it shows the recipient as “janejones” and not “Jane Jones.” I don’t have an easy way to send a screenshot.

@mscitadmin,

Unfortunately, we are not able to reproduce this at our end with Office 365 test account as below. The name always comes in as specified. Could you please give it a try at your end and let us know your feedback?

Sample Code

IEWSClient client = test account // Username: "Userone@asposeSep2017.onmicrosoft.com") , password: Aspose1234
MailMessage msg = new MailMessage();
msg.From = new MailAddress("Userone@asposeSep2017.onmicrosoft.com", “User One”);
msg.To.Add(new MailAddress("to@gmail.com", “Someone Good”));
msg.Subject = “Sending message from exchange server via Aspose”;
msg.HtmlBody = “Sending message from exchange server via Aspose”;
client.Send(msg);