|
查看: 1814|回复: 5
|
asp.net c# send email
[复制链接]
|
|
|
我在网上找了很多tutorial, 也照做了,
以下是我的code
MailMessage mail = new MailMessage();
mail.From = new MailAddress("xxx@hotmail.com");
mail.To.Add(new MailAddress(xxx@gmail.com"));
mail.Subject = "testting";
mail.Body = "body";
mail.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient();
smtp.Host = "localhost";
smtp.Send(mail);
可是它还是send 不出, 请问要做什么setting 吗?? |
|
|
|
|
|
|
|
|
|
|
发表于 13-12-2009 04:17 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 13-12-2009 04:41 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 14-12-2009 12:25 AM
|
显示全部楼层
我在网上找了很多tutorial, 也照做了,
以下是我的code
MailMessage mail = new MailMessage();
...
amulo 发表于 13-12-2009 12:20 AM 
用gmail的smtp就可以了 |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 15-12-2009 11:10 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
发表于 18-12-2009 04:29 PM
|
显示全部楼层
如果要setting iis 的smtp 如下:
1)Make sure that the SMTP server is running, only then it can relay mail. If not, open the IIS window, in IIS look for the "local computer" on the left side tree view under which you will see the "Default SMTP Virtual Server", if it is not available, then you need to install it.
2)To configure "Default SMTP Virtual Server", right-click on it, go into "Properties", and select "Access" tab, and then click the "Relay" button. With "only the list below" radio button selected, you should see the local IP address: "127.0.0.1", if it's not there, you need to add it.
3)If you are using "localhost" or "127.0.0.1" as the SmtpMail.SmtpServer, make sure "Anonymous access is allowed". To allow access, open up the IIS. Locate the SMTP virtual server, and right-click select Properties. On the Access tab, click the Authentication button. Make sure "Anonymous Access" is the only checkbox checked.
4)Use real from and to addresses that exist on the SmtpMail.SmtpServer. Do not use invalid address. |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|