NovelProjects

Wednesday, January 14, 2009

MailMessage.ReplyTo Property

We frequently send emails through .NET using hosted gmail as the server. If you have any experience with this, you'll know that you can't set the sender of email. Gmail will use the email of the account you log in with on the SmtpClient.


So for instance you want to have a contact form on your website that submits the form to you so that you can reply directly to the customer. When you receive the email the sender will be the account you authenticated with not the email of the customer.


But have no fear! In this case you can use the MailMessage.ReplyTo property and set that to the email address of the customer. So now when you hit 'Reply To' you'll be replying directly to the customer and not the account that sent the email.

1 comments:

Nate said...

Also a great way to set a practical joke on your friends. Not saying I've done that, but you know who you are if you know what I'm talking about.

Post a Comment

Note: Only a member of this blog may post a comment.