日期:2014-05-18  浏览次数:20567 次

!!!!!!!!!!!!!!请问asp.net有没有邮件控件或者.dll或者安装的那种,或者谁有完整的源代码可以给我啊?解决后立刻结贴。
如果哪位能给我的控件必须是那种客户端不需要安装的那种。

------解决方案--------------------
有个 CDO.MessageClass 不知道是否符合你的期望.
你搜索下看看.
------解决方案--------------------
#region 发送邮件

/// <summary>
/// 发送邮件
/// </summary>
/// <param name= "_UserName "> 用户名 </param>
/// <param name= "_Mail "> 用户注册的电子邮件 </param>
/// <param name= "_Pwd "> 用户登录密码 </param>
/// <returns> 是否发送成功 </returns>
public bool SendMail (string _UserName,string _Mail,string _Pwd)
{
string _adminMail = System.Configuration.ConfigurationSettings.AppSettings[ "AdminMail "].ToString();
string _adminMailPwd = System.Configuration.ConfigurationSettings.AppSettings[ "AdminMailPwd "].ToString();
string _adminMailSmtp = System.Configuration.ConfigurationSettings.AppSettings[ "AdminMailSMTP "].ToString();

MailMessage mailObj = new MailMessage();
mailObj.To = _Mail;
mailObj.From = _adminMail;

mailObj.Subject = "您的内网密码 ";
mailObj.Body = "尊敬的用户: <br/> &nbsp;&nbsp;&nbsp;&nbsp;您好,您的内网注册信息如下 <br/> 用户名: " + _UserName + " 密码: " + _Pwd;

mailObj.BodyFormat = MailFormat.Html;

mailObj.Priority = MailPriority.High;

SmtpMail.SmtpServer = _adminMailSmtp;
//mailObj.Attachments.Add(new MailAttachment( "c:\\swf\\000.bmp "));


string[] adminName = _adminMail.Split( '@ ');
///////////////////////////////////FrameWork1.1
mailObj.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate ", "1 ");
////设置验证用户名
mailObj.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername ", adminName[0].ToString());
////设置验证密码
mailObj.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword ", _adminMailPwd);
//////////////////////////////////////////////

SmtpMail.Send(mailObj);
return true;
}
#endregion
------解决方案--------------------
frameWork 2.0


============================

/// <summary>
/// 发送邮件
/// </summary>
/// <param name= "strSmtpServer "> smtp地址 </param>
/// <param name= "UserName "> 用户名 </param>
/// <param name= "Password "> 密码 </param>
/// <param name= "strFrom "> 发信人地址 </param>
/// <param name= "strto "> 收信人地址 </param>
/// <param name= "strSubject "> 邮件标题 </param>
/// <param name= "strBody "> 邮件正文 </param>
public static void SendMail(string strSmtpServer, string UserName, string Password, string strFrom, string strto, string strSubject, string strBody, string strFileName)
{
//生成一个 使用SMTP发送邮件的客户端对象
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient(strSmtpServer);

//表示以当前登录用户的默认凭据进行身份验证
client.UseDefaultCredentials = true;



//包含用户名和密码
client.Credentials = new System.Net.NetworkCredential(UserName, Password);

//指定如何发送电子邮件。
//Network