I'm currently using System.Net.Mail in the following fashion:
Message.BodyEncoding = Encoding.UTF8
Message.From = New System.Net.Mail.MailAddress(EMail)
Message.IsBodyHtml = True
Message.Subject = theSubject
Message.Body = theBody
Dim client As New System.Net.Mail.SmtpClient()
client.UseDefaultCredentials = False
client.Credentials = New System.Net.NetworkCredential(EMail, EMailPwd)
client.EnableSsl = True
client.Host = "smtp.gmail.com"
client.Port = 587
Sending it this way works fine. But when trying to specify a display name:
Message.From = New System.Net.Mail.MailAddress(EMail, firstName & " " & lastName)
I never receive the message, and it doesn't throw an exception. I've also tried formatting it this way:
Message.From = New System.Net.Mail.MailAddress(fullName & " <" & EMail & ">")
Is there a reason this keeps failing without giving any sort of error? Is there a restriction from Gmail's SMTP server that's blocking it, perhaps?
After messing with it, I was able to get it to send by specifying a unicode encoding type for the from address:
Message.From = New System.Net.Mail.MailAddress(EMail, FirstName & " " & LastName, Encoding.Unicode)