L
Leszek
Hello,
I have created a simple code to send emails using the MailMessage class and
the SmtpMail.Send() method:
MailMessage mail = new MailMessage();
mail.From = (e-mail address removed); // hard-coded
mail.To = (e-mail address removed);
mail.Subject = "Test";
mail.Body = strMessage;
mail.BodyFormat = MailFormat.Html;
SmtpMail.Send(mail);
It works fine as long as the mail.From address is hard-coded. When I changed
the line to:
string strEmail = txtEmail.Value;
mail.From = strEmail;
txtEmail is an HTML server-control:
<input id="txtEmail" type="text" maxLength="40" size="20" name="txtEmail"
runat="server">
the code stopped working. I mean it does not send emails and even does not
throw any exception!!!
Is there any possibility to check the status of a sent message? Does
SmtpMail have any "error" property to check if the email has been sent
properly?
If I could not be sure that the message has been sent properly the
SmtpMail.Send() method would be of no use.
Please advice what to do. Should I use SmtpMail.Send() or maybe another
method?
Thanks for any hints,
Leszek Taratuta
I have created a simple code to send emails using the MailMessage class and
the SmtpMail.Send() method:
MailMessage mail = new MailMessage();
mail.From = (e-mail address removed); // hard-coded
mail.To = (e-mail address removed);
mail.Subject = "Test";
mail.Body = strMessage;
mail.BodyFormat = MailFormat.Html;
SmtpMail.Send(mail);
It works fine as long as the mail.From address is hard-coded. When I changed
the line to:
string strEmail = txtEmail.Value;
mail.From = strEmail;
txtEmail is an HTML server-control:
<input id="txtEmail" type="text" maxLength="40" size="20" name="txtEmail"
runat="server">
the code stopped working. I mean it does not send emails and even does not
throw any exception!!!
Is there any possibility to check the status of a sent message? Does
SmtpMail have any "error" property to check if the email has been sent
properly?
If I could not be sure that the message has been sent properly the
SmtpMail.Send() method would be of no use.
Please advice what to do. Should I use SmtpMail.Send() or maybe another
method?
Thanks for any hints,
Leszek Taratuta