SmtpMail Question

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

Evidently the SmtpMail class doesn't throw an exception when the SMTP server
returns an error? It just lets you happily think the email was sent when
actually it was rejected by the SMTP server. I found this out by having my
app connect to DevNull's Dummy SMTP server. Seems I was sending just the
@domain part of the "FROM" address. Correcting that got my emails going.

Now, how do I get the From to display a friendly name instead of my email
address? I tried several variations of setting MailMessage.From="My Program
<[email protected]>". But everything I tried got rejected by the SMTP server
unless I only used the email address itself. I'm thinking I need to add the
"From: My Program" and "Reply-To: (e-mail address removed)" headers to the email
but I'm not sure how to do that.

Appreciate any help.

Thanks.
 
The correct form to get a friendly name showing up in the From field is:
Mail.From = "MyName <[email protected]>"
which it looks like is what you are doing so you might have another problem.

To add a reply-to header do this:
Mail.Headers.Add("reply-to", "(e-mail address removed)")

Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top