用jmail吧。我有代码:
/// <summary>
/// SendMail 邮件发送程序 Editer:Ghost Date:2003-09-09。
/// 使用方法如下:
/// string form = "[email protected]";
/// string to = "[email protected]";
/// string subject = "主题";
/// string body = "见附件";
/// string attfile = "C:\test.zip";
/// Ghost.Component.SendMail sendmail = new Ghost.Component.SendMail(form,to,subject,body,attfile);
/// if(sendmail.Send)
/// {
/// Response.Write("发送成功!");
/// }
/// else
/// {
/// Response.Write("发送失败!");
/// }
///</summary>
public class SendMail
{
public string From;
public string To;
public string Subject;
public string Body;
public string AttFile; protected string from
{
get
{
return From;
}
set
{
From = value;
}
}
protected string to
{
get
{
return To;
}
set
{
To = value;
}
}
protected string subject
{
get
{
return Subject;
}
set
{
Subject = value;
}
}
protected string body
{
get
{
return Body;
}
set
{
Body = value;
}
}
protected string attfile
{
get
{
return AttFile;
}
set
{
AttFile = value;
}
} public bool Send
{
get
{
return this.SendMessage();
}
} protected bool SendMessage()
{
try
{
jmail.MessageClass mail = new jmail.MessageClass();
mail.From = from;
mail.FromName = "MMPIS";
mail.AddRecipient(to,"","");
mail.Subject = subject;
mail.Body = body;
mail.Charset = "gb2312";
mail.AddAttachment(attfile,false,"");
mail.MailServerUserName = "ghost";
mail.MailServerPassWord = "ghost";
if(mail.Send( "mail.jsqyw.com",false))
{
return true;
}
return false;
}
catch
{
return false;
}
} public SendMail(string from,string to,string subject, string body, string attfile)
{
this.From = from;
this.To = to;
this.Subject = subject;
this.Body = body;
this.AttFile = attfile;
}
public SendMail()
{
//
}
}
在引入jmail是,在com组件中引用,不要在.net框架内中引入

解决方案 »

  1.   

    有没有用SmtpMail 和MailMessage做的,我是用他们作的,只是不知道SmtpServer如何设置,因为老板给的邮件服务器老是不对。
      

  2.   

    帖主给一个邮箱吧,我发一篇文章给你吧。我没有记录网页url地址。:(,只好发邮件给你了啦。   lrxz(九月鹰飞.Net)给的jmail组件的例子可以好好参考哦。
      

  3.   

    哦,提醒一下。  关键是smtpmail类没有办法加入smtpserver验证,所以只能借用其他办法或者说是组件(如上面的jmail组件)。
      

  4.   

    jianglinchun兄,某的邮箱是[email protected],多谢!
      

  5.   

    邮件已经发送了。如果你收不到,发邮件给我:[email protected]
      

  6.   

    lrxz(九月鹰飞.Net)兄所说的Jmail从哪里得到?
      

  7.   

    MailMessage MyMsg = new MailMessage();
    MyMsg.From = "[email protected]";
    MyMsg.Cc = "[email protected]";
    MyMsg.To = "[email protected]";
    MyMsg.Subject = "tt";
    MyMsg.Priority = MailPriority.High;
    MyMsg.BodyFormat = MailFormat.Html;
    MyMsg.Body = "tt!";

    try
    {
          SmtpMail.SmtpServer = "mail.tt.com"; 
      SmtpMail.Send(MyMsg);   
    }
    catch(Exception ee)
    {   
    }
      

  8.   

    http://www.csdn.net/develop/article/17/17368.shtmhttp://www.csdn.net/develop/article/17/17189.shtm
      

  9.   

    EMAIL发送系统(C#+基于SMTP认证)http://www.lionsky.net/MyWebSite/article/list.aspx?id=430
      

  10.   

    用   houjianxun(三千弱水)(独取一瓢清泉)  的吧  我用了非常好 还有dll的源码 和 发送Email的源码 完全是自己写的代码 (连接到smtp 都是自己写的)
    smtp 类写成了DLL 不过 有源码 (在项目属性->配置属性->生成->XML文档文件  在名字中输入和DLL一样的名称.xml)这样编译过后会有个.xml 文件生成这样加载DLL是 使用属性和方法会有 智能感知注释 (MS给取的这名字怪怪的)呵呵 才会用  智能感知注释 和大家说一下
      

  11.   

    对了   houjianxun(三千弱水)(独取一瓢清泉)  的 那个 我的本机的smtp服务没有成功 
    不知道 该如何设制 
    会的人能说一下吗?
      

  12.   

    那是你本机的SMTP或DNS服务设置不正确
      

  13.   

    www.life369.com 个人助手-->邮件发送
       可以知道如何设置了。 详细请:[email protected]