哈欠的个人房间
左,右,到底我要向哪走?
posts - 5,  comments - 1,  trackbacks - 0
代码如下:
using System.Web.Mail;
                        
public static void SendMail(string to, string subject, string body)
        
{
            MailMessage mail 
= new MailMessage();
            mail.From 
= "\"发送者的名字\" <你的邮箱地址>";//设定发件人名字和地址(必须填写)
            mail.BodyFormat = MailFormat.Html;//用html格式
            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate""1"); //basic authentication
            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","邮箱用户名"); //设定SMTP验证的用户名
            mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword""邮箱密码"); //设定SMTP验证的密码        
            SmtpMail.SmtpServer = "smtp服务器";//设定SMTP服务器地址,如smtp.163.com
            mail.To = to ;//设定收件人地址(必须填写)。
            mail.Subject = subject;
            mail.Body 
= body;
            SmtpMail.Send(mail);

        }

大家注意到mail.From = "\"发送者的名字\" <你的邮箱地址>"; 了吗?
发送者的名字是你想邮件用什么名字发送,用什么名字都行,如:
posted on 2005-12-14 10:23 哈欠 阅读(552) 评论(0)  编辑 收藏 引用
只有注册用户登录后才能发表评论。

<2005年12月>
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

常用链接

留言簿(1)

随笔档案(5)

相册

搜索

  •  

最新评论

阅读排行榜

评论排行榜