strange web.mail problem

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.
 
R

Robert May

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
 

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

Top