Click here to Skip to main content
15,747,766 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I tried this code but I received it in "C:\Inetpub\mailroot\Queue" not delivering to respective ID.
MailMessage mail = new MailMessage();
mail.From = "";
mail.To = "";
mail.Subject = "Test";
mail.Body = readfrombody();
mail.BodyFormat = MailFormat.Text;
SmtpMail.SmtpServer = "localhost";

can anybody give me ans now?
Updated 27-Dec-10 20:04pm
Dalek Dave 28-Dec-10 2:03am    
Edited for Grammar and code block.

kavinnagarajan wrote:
SmtpMail.SmtpServer = "localhost";

There are many possible reason for that.

1. Are you sure that localhost is your SMTP Address ?
2. Make sure SMTP configure properly.
3. Are you system is behind the Network Firewall ?
4. Does your port block by that firewall ?

You can try this steps :

1. Start > Run > InetMgr
2. Expand CompterName > Right click "Default Virtual SMTP server"
3. Goto Delivery Tab
4. Set lower values for: "first retry interval", "second try interval", "third retry interval", "subsequent retry interval" to 1. Then Try it once.

Hope this will help you :-D

Share this answer
Dalek Dave 28-Dec-10 2:04am    
Good Answer.
Hi Friend,

Please Check the following article to send email from gmail account.
Share this answer
Dalek Dave 28-Dec-10 2:04am    
Good Link.
Hi Kavinnagarajan,

Please check the following as well.

1. The SmtpServer must be assigned to an Exchange Server address, I am not sure that you can use 'localhost'.
2. The IP address of your computer must be SMTP enabled

Hope this will help.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900