佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1776|回复: 5

asp.net c# send email

[复制链接]
发表于 13-12-2009 12:20 AM | 显示全部楼层 |阅读模式
我在网上找了很多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 吗??
回复

使用道具 举报


ADVERTISEMENT

发表于 13-12-2009 04:17 PM | 显示全部楼层
SMTP Server 已安装了吗?
回复

使用道具 举报

发表于 13-12-2009 04:41 PM | 显示全部楼层
POP3吗?

asp这我没研究 呵呵
回复

使用道具 举报

发表于 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 | 显示全部楼层
我用gmail 的smtp。。。可以了。谢谢各位
回复

使用道具 举报

发表于 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.
回复

使用道具 举报

Follow Us
您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 2-12-2025 12:41 AM , Processed in 0.130537 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表