strange web.mail problem

  • Thread starter Thread starter John McD
  • Start date Start date
J

John McD

I'm trying to have a method in a page which checks the
database for user's email.
The query populates the variable strEmailTo and then sends
the email:

MailMessage msg = new MailMessage();
msg.To = strEmailTo;
msg.From = strEmailFrom;
msg.Subject = "whatever";
msg.Body = "whatever";
SmtpMail.SmtpServer=strSMTP;
SmtpMail.Send(msg);

However no email is recieved and no error message comes up.

The strange part is that if I hardcode the variable value:
strEmailTo="(e-mail address removed)"; it works.
The query is definitely passing the variable the same value
(I'm displaying it on the screen).

Any suggestions? TIA, John.
 
Do some tracing to see what is really being passed in as your variables,
just to be sure.

Additionally, if you're using Exchange as your server, it may not think that
the message is allowed to send. Check the outbound queues to see if
something is really getting to them and it's just dumping the message.

Robert
 
Back
Top