tags:

views:

31

answers:

1

Does anyone see anything wrong with this code:

MailMessage msg = new MailMessage();

msg.From = new MailAddress(WebConfigurationManager.AppSettings.Get("ReservationsFrom"));
msg.ReplyTo = new MailAddress(myRes.Email);
msg.To.Add(new MailAddress(WebConfigurationManager.AppSettings.Get("ReservationsTo")));
msg.CC.Add(new MailAddress(WebConfigurationManager.AppSettings.Get("ReservationsBcc")));

Try as I might, I can only get the 'To' address and the "ReplyTo" to work, the CC and the BCC never receive mail, even if I hard code the addresses in.

Am I missing something obvious here?

Edit: And yes, I am sure I am pulling the right addresses out of the web.config - like I said, even if I hard code a static address the BCC and CC never received email.

+1  A: 

If static addresses hard-coded into the method calls aren't working, you're having a problem with delivery, not the addresses.

Can you telnet to port 25 on the smtp host you're using? Can you send an email to the test addresses from a regular email client (not web-based)?

Dave Swersky
Yes and yes, it is weird. Even if I put the same address in all 3 places (to, cc, bcc), only the 'to' is working. I've tried all the obvious stuff. Going to try a new smpt host and see if it works any better...
EJB
Check the email header that is received as well, make sure they're actually in there...
Dave Swersky
I think it must be my ISP..tried another SMTP host and it worked fine. I'll take it up with them.
EJB