Sending mail using SMTP
-
Hi All, here is a code snippet from my mail program. SmtpMail.SmtpServer = "localhost"; SmtpMail.Send (myemail); myemail is an object of MailMessage. If i run this program for the first time in Visual Studio there is an error saying CDO.Message is not accessible. When it runs all the mail messages are stored in c:\inetpub\mailroot\queue they do not reach there destinatin. They all are stored in my computer only. Please someone tell me how to solve this. WIll be eagrly waiting for the answer.
-
Hi All, here is a code snippet from my mail program. SmtpMail.SmtpServer = "localhost"; SmtpMail.Send (myemail); myemail is an object of MailMessage. If i run this program for the first time in Visual Studio there is an error saying CDO.Message is not accessible. When it runs all the mail messages are stored in c:\inetpub\mailroot\queue they do not reach there destinatin. They all are stored in my computer only. Please someone tell me how to solve this. WIll be eagrly waiting for the answer.
Can you post the details of how you're setting up myemail? Make sure the From property is set. Also, use a try/catch block to capture the exception and look for InnerExceptions. An InnerException may give more details as to the nature of the problem.
-
Can you post the details of how you're setting up myemail? Make sure the From property is set. Also, use a try/catch block to capture the exception and look for InnerExceptions. An InnerException may give more details as to the nature of the problem.
Thanx for replying! i have used this code .. private void button1_Click(object sender, System.EventArgs e) { MailMessage myemail = new MailMessage(); myemail.From ="Tushar"; myemail.To ="a_tushar@hotmail.com"; myemail.Subject ="Test"; myemail.Body ="How are you "; System.Web.Mail.SmtpMail.SmtpServer = "localhost"; System.Web.Mail.SmtpMail.Send (myemail); } using this all my mails are stored on my computer only they are not being delivered at a_tushar@hotmail.com
-
Hi All, here is a code snippet from my mail program. SmtpMail.SmtpServer = "localhost"; SmtpMail.Send (myemail); myemail is an object of MailMessage. If i run this program for the first time in Visual Studio there is an error saying CDO.Message is not accessible. When it runs all the mail messages are stored in c:\inetpub\mailroot\queue they do not reach there destinatin. They all are stored in my computer only. Please someone tell me how to solve this. WIll be eagrly waiting for the answer.
-
Thanx for replying! i have used this code .. private void button1_Click(object sender, System.EventArgs e) { MailMessage myemail = new MailMessage(); myemail.From ="Tushar"; myemail.To ="a_tushar@hotmail.com"; myemail.Subject ="Test"; myemail.Body ="How are you "; System.Web.Mail.SmtpMail.SmtpServer = "localhost"; System.Web.Mail.SmtpMail.Send (myemail); } using this all my mails are stored on my computer only they are not being delivered at a_tushar@hotmail.com
Well, the from should be an e-mail address.
-
Well, the from should be an e-mail address.
This isn't his problem. As Mazdak said, we answer his question several days ago. His problem is that he hasn't configured the SMTP Virtual Server in the Internet Information Manager. I gave him pointers how to get started and told him to read the help, but he obviously hasn't.
-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
Hi All, here is a code snippet from my mail program. SmtpMail.SmtpServer = "localhost"; SmtpMail.Send (myemail); myemail is an object of MailMessage. If i run this program for the first time in Visual Studio there is an error saying CDO.Message is not accessible. When it runs all the mail messages are stored in c:\inetpub\mailroot\queue they do not reach there destinatin. They all are stored in my computer only. Please someone tell me how to solve this. WIll be eagrly waiting for the answer.
Once again I'll tell you that you're code isn't the problem - the problem is that you have NOT configured the SMTP Virtual Server at all or correctly. Again, go to Internet Information Manager in your Administrative Tools folder in the Control Panel and find the SMTP Virtual Server. You have to configure this to send mail using SMTP. It isn't setup by default but there's very little to do. Just read the help files which should be easy to understand. Once again - as Mazdak also said - this is not a problem with your code, hence quit posting it in the C# forum. It is a problem with your machine configuration of the SMTP Virtual Server. If you need additional help, go to http://support.microsoft.com[^]. It really isn't hard to configure, though.
-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----