Problem to sending mail
-
I applied following code. Output show Msg sent successfully. Actually never it is sent to destination. Messages are only push to C:\inetpub\mailroot\queue; 1.I think IIS can not push the emails out on the internet.How can I look on SMTP response code. 2.I want to send emails from localhost. Now I confused how it possible sending a mail from anonymous mail address like "shahdat_mbstu@yahoo.com" through localhost, bcoz there no relation between my localhost and my mail address "shahdat_mbstu@yahoo.com". ; 3. Please help me!; public void CreateCopyMessage(string server) { MailAddress from = new MailAddress("shahdat_mbstu@yahoo.com", "Ben Miller"); MailAddress to = new MailAddress("shahdat45ict@yahoo.com", "Shahdat Kooras");//jane@contoso.com MailMessage message = new MailMessage(from, to); // message.Subject = "Using the SmtpClient class."; message.Subject = "Using the SmtpClient class."; message.Body = @"Using this feature, you can send an e-mail message from an application very easily."; // Add a carbon copy recipient. MailAddress copy = new MailAddress("Notification_List@contoso.com"); message.CC.Add(copy); SmtpClient client = new SmtpClient(server); // Include credentials if the server requires them. client.Credentials= client.Credentials = CredentialCache.DefaultNetworkCredentials; Console.WriteLine("Sending an e-mail message to {0} by using the SMTP host {1}.", to.Address, client.Host); try { client.Send(message); lblMessage.Text = "Message successfully sent"; } catch (Exception ex) { Console.WriteLine("Exception caught in CreateCopyMessage(): {0}", ex.ToString()); } }
shahdat
-
I applied following code. Output show Msg sent successfully. Actually never it is sent to destination. Messages are only push to C:\inetpub\mailroot\queue; 1.I think IIS can not push the emails out on the internet.How can I look on SMTP response code. 2.I want to send emails from localhost. Now I confused how it possible sending a mail from anonymous mail address like "shahdat_mbstu@yahoo.com" through localhost, bcoz there no relation between my localhost and my mail address "shahdat_mbstu@yahoo.com". ; 3. Please help me!; public void CreateCopyMessage(string server) { MailAddress from = new MailAddress("shahdat_mbstu@yahoo.com", "Ben Miller"); MailAddress to = new MailAddress("shahdat45ict@yahoo.com", "Shahdat Kooras");//jane@contoso.com MailMessage message = new MailMessage(from, to); // message.Subject = "Using the SmtpClient class."; message.Subject = "Using the SmtpClient class."; message.Body = @"Using this feature, you can send an e-mail message from an application very easily."; // Add a carbon copy recipient. MailAddress copy = new MailAddress("Notification_List@contoso.com"); message.CC.Add(copy); SmtpClient client = new SmtpClient(server); // Include credentials if the server requires them. client.Credentials= client.Credentials = CredentialCache.DefaultNetworkCredentials; Console.WriteLine("Sending an e-mail message to {0} by using the SMTP host {1}.", to.Address, client.Host); try { client.Send(message); lblMessage.Text = "Message successfully sent"; } catch (Exception ex) { Console.WriteLine("Exception caught in CreateCopyMessage(): {0}", ex.ToString()); } }
shahdat
check the event log for errors. That should give you a hint as to what is going on.
Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
-
I applied following code. Output show Msg sent successfully. Actually never it is sent to destination. Messages are only push to C:\inetpub\mailroot\queue; 1.I think IIS can not push the emails out on the internet.How can I look on SMTP response code. 2.I want to send emails from localhost. Now I confused how it possible sending a mail from anonymous mail address like "shahdat_mbstu@yahoo.com" through localhost, bcoz there no relation between my localhost and my mail address "shahdat_mbstu@yahoo.com". ; 3. Please help me!; public void CreateCopyMessage(string server) { MailAddress from = new MailAddress("shahdat_mbstu@yahoo.com", "Ben Miller"); MailAddress to = new MailAddress("shahdat45ict@yahoo.com", "Shahdat Kooras");//jane@contoso.com MailMessage message = new MailMessage(from, to); // message.Subject = "Using the SmtpClient class."; message.Subject = "Using the SmtpClient class."; message.Body = @"Using this feature, you can send an e-mail message from an application very easily."; // Add a carbon copy recipient. MailAddress copy = new MailAddress("Notification_List@contoso.com"); message.CC.Add(copy); SmtpClient client = new SmtpClient(server); // Include credentials if the server requires them. client.Credentials= client.Credentials = CredentialCache.DefaultNetworkCredentials; Console.WriteLine("Sending an e-mail message to {0} by using the SMTP host {1}.", to.Address, client.Host); try { client.Send(message); lblMessage.Text = "Message successfully sent"; } catch (Exception ex) { Console.WriteLine("Exception caught in CreateCopyMessage(): {0}", ex.ToString()); } }
shahdat
Please read this link, this will help you to resolve your issue. IIS Virtual SMTP server not sending. Mail stuck in mailroot\queue folder.
cheers, Abhijit CodeProject MVP