jaypee bacol

jaypee bacol

  • NA
  • 67
  • 0

email just stored in C:\Inetpub\mailroot\Queue and not being sent

Jan 8 2010 10:53 PM

Hi All,
I created web appliction to send email using SmtpClient() and MailMessage() objects. When I clicked the button, the message was sent successfully and it just goes to C:\Inetpub\mailroot\Queue directory. Please help me on how to solve this. I am thinking this related to IIS issue? Below is my code.
 
SmtpClient
smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
try
{

MailAddress fromAddress = new MailAddress(txtFrom.Text, txtFrom.Text);
MailAddress toAddress = new MailAddress(txtTo.Text);
smtpClient.Host =
"localhost";


smtpClient.Port = 25;

message.From = fromAddress;

message.To.Add(toAddress);
message.Subject =
"Feedback";


message.IsBodyHtml =
false;

message.Body = txtMessage.Text;

message.Priority =
MailPriority.High;
smtpClient.Send(message);




lblResult.Text =
"Email successfully sent.";
}
catch (Exception ex)
{
lblResult.Text =
"Send Email Failed." + ex.Message;
}
Thanks,

Answers (3)