jmail发送
[jmail.dll下载]
第一步:注册jmail

     方法一:windows --> 运行 --> cmd --> cd jmail目录 --> regsvr32 jmail.dll --> 注册成功 

     方法二:将jmail.dll复制到C:\WINDOWS\system32,然后到运行里打regsvr32 jmail.dll
第二步:引用
   项目引用COM组建 jmail 4.0 library
第三步:代码

jmail.Message jm = new jmail.Message();
jm.Silent 
= true;
jm.Logging 
= true;
jm.Subject 
= "test";
jm.Charset 
= "gb2312";
jm.ContentType 
= "text/html";
jm.From 
= "sjoem@sjoem.com";
jm.ReplyTo 
= "sjoem@sjoem.com";
jm.FromName 
= "lidi";
jm.MailServerUserName 
= "username";
jm.MailServerPassWord 
= "pwd";
jm.Body 
= "test";
jm.AddRecipient(
"lidi@sjoem.com""""");
if (jm.Send("mail.sjoem.com"false))
    Response.Write(
"success");
else
    Response.Write(
"fail");


VS自带的SMTPCLIENT发送

using System.Net.Mail;

MailMessage mailMessage 
= new MailMessage();
string strBody;
//发送地址
mailMessage.From = new MailAddress("shasibingdu@163.com");
//接收地址
mailMessage.To.Add("ldgg@vip.qq.com");
//邮件标题
mailMessage.Subject = "测试";
//邮件内容
strBody = "呵呵";
mailMessage.Body 
= strBody;
SmtpClient smtpClient 
= new SmtpClient();
//smtpClient.EnableSsl = true;
//Smtp服务器
smtpClient.Host = "smtp.163.com";
//Smtp服务器发送端口
smtpClient.Port = 25;
//发送用户名及密码
smtpClient.Credentials = new NetworkCredential("username""pwd");
try
{
    
//调用发送函数
    smtpClient.Send(mail);
    Label1.Text 
= "ok";
}

catch
{
    Label1.Text 
= "false";
}

 posted on 2008-07-04 11:12  ︷起↘嚸.  阅读(402)  评论(0编辑  收藏  举报