Hi,
I'm using VS 2008, targeting framework 3.5, and trying to utilize the
ReplyTo property of the MailMessage object to redirect failed emails
to a specific email address. Normally I just use the From property,
but in this case my From is "[email protected]", which doesn't
really exist, but I still want to make sure that failed emails get
back to a real email address. Everything I've read online indicates
that I should be able to use the ReplyTo property and specify a
different address from the From address. However, when I tested this,
my email failure still went to the From address for some reason. I've
done a bunch of searches for anyone else having had this issue, but
for some reason, I haven't been able to find anyone, so I'm hoping
someone here can help me out.
Here is my test code:
Dim objMailer As New Net.Mail.SmtpClient
objMailer.Host = "SMTP.mycompany.com"
Dim objMail As New Net.Mail.MailMessage
objMail.From = New Net.Mail.MailAddress(lblFromAddress.Text.Trim)
objMail.ReplyTo = New
Net.Mail.MailAddress(lblReplyToAddress.Text.Trim)
objMail.To.Add(lblToAddress.Text.Trim)
objMail.Subject = "Test Email"
objMail.Body = "This is only a TEST. Please ignore!"
objMail.Priority = Net.Mail.MailPriority.Normal
objMail.IsBodyHtml = False
Try
objMailer.Send(objMail)
lblEmailTestMsg.Text = "Email Successfully Sent @ " &
Now().ToString
Catch ex As Exception
Throw New ApplicationException(ex.Message)
Finally
Try
objMail.Dispose()
Catch ex As Exception
Finally
objMail = Nothing
End Try
Try
objMailer = Nothing
Catch ex As Exception
End Try
End Try
Any help you could provide would be greatly appreciated! Before you
ask, yes, the Host value I'm using (not the real value above) is a
valid SMTP server address that works.
Thanks,
Larry
--
You received this message because you are subscribed to the Google
Groups "DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML
Web Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/dotnetdevelopment?hl=en?hl=en
or visit the group website at http://megasolutions.net