用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框架内中引入
/// <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框架内中引入
解决方案 »
- |zyciis| 网站如何获取当前浏览的“WEB浏览证书”的用户名
- 建VS08的Framework2.0项目时为什么没有AJAX项目??
- C#中excel保存的副本问题
- VS2005中的ASP如何实现Dropdownlist和listbox的三级联动
- ===GridView分页模板PagerTemplate里怎么得到控件的名字.... ===
- ASP网站转成asp.net
- 请问怎么控制datagrid控件中链接列的文本字符长度呢?
- DropDownList在JavaScript中的使用的一个问题
- 短信接口
- DataGrid能不能解除Binding?怎么解除?
- 请问如何在Select...From语句中使用IIF函数。请举几个具体例子。谢谢!
- Microsoft .NET 的企业解决方案模式,那有电子文档下载,谢谢!!!
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)
{
}
smtp 类写成了DLL 不过 有源码 (在项目属性->配置属性->生成->XML文档文件 在名字中输入和DLL一样的名称.xml)这样编译过后会有个.xml 文件生成这样加载DLL是 使用属性和方法会有 智能感知注释 (MS给取的这名字怪怪的)呵呵 才会用 智能感知注释 和大家说一下
不知道 该如何设制
会的人能说一下吗?
可以知道如何设置了。 详细请:[email protected]