我用的邮件发送代码是
MailMessage mm = new MailMessage();
mm.To = "[email protected]"; mm.Priority = MailPriority.High;
mm.From = "[email protected]";
mm.Subject = "aaa";
mm.BodyFormat = MailFormat.Text;
mm.Body = EmailContent;
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
//设置验证用户名
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "xxxx");
//设置验证密码
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "xxxx");
SmtpMail.SmtpServer = "smtp.126.com" ; SmtpMail.Send(mm);
06年11月以后注册的号用这个就好使,但是现在那之后新注册的号就不好使了官方好像取消了POP什么的如果我不加SmtpMail.SmtpServer = "smtp.126.com" ,让程序自动读取本地服务器的话也不好使,原因应该是租用的空间的问题吧现在的问题,怎么样才能用这个新注册的号区用程序发邮件,程序是VS03,dotnet1.1的
忘各位新程序员让路,老鸟来指点,我不要VS05以后的代码问题解决另开贴加分
MailMessage mm = new MailMessage();
mm.To = "[email protected]"; mm.Priority = MailPriority.High;
mm.From = "[email protected]";
mm.Subject = "aaa";
mm.BodyFormat = MailFormat.Text;
mm.Body = EmailContent;
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
//设置验证用户名
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "xxxx");
//设置验证密码
mm.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "xxxx");
SmtpMail.SmtpServer = "smtp.126.com" ; SmtpMail.Send(mm);
06年11月以后注册的号用这个就好使,但是现在那之后新注册的号就不好使了官方好像取消了POP什么的如果我不加SmtpMail.SmtpServer = "smtp.126.com" ,让程序自动读取本地服务器的话也不好使,原因应该是租用的空间的问题吧现在的问题,怎么样才能用这个新注册的号区用程序发邮件,程序是VS03,dotnet1.1的
忘各位新程序员让路,老鸟来指点,我不要VS05以后的代码问题解决另开贴加分
所以不管你用VS2003还是VS2005都是发不出去!
smtp.gmail.com试试
1.安装jmail4.3
2.找到jmail.dll(Program Files\Dimac\w3JMail4下)
3.执行Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Bin\ildasm.exe,
格式如下:tlbimp jmail.dll /out:myJmail.dll /namespace:myJmail
生成myJmail.dll后,copy到web的根目录的bin目录,
在vs.net中引用 using jmail;
在其他机器上注册
在运行窗口中运行 regsvr32 E:\jmail\jmail.dll 然后在项目中引用jmail
using myJmail;
Message jmailobj=new Message();
jmailobj.Logging=true;
jmailobj.Silent=true;
jmailobj.MailServerUserName="username"; //发信邮件服务器的帐号
jmailobj.MailServerPassWord="pwd"; //密码
jmailobj.Body="ok";
jmailobj.Charset="gb2312";
jmailobj.Subject="这个是JMAIL测试!";
jmailobj.From="[email protected]";
jmailobj.FromName="test";
jmailobj.AddRecipient("[email protected]","Name","A"); //收件人地址
//jmailobj.AddRecipientBCC("[email protected]","ok");//抄送
//jmailobj.AddRecipientBCC("[email protected]","ok");
jmailobj.Priority =1;
//jmailobj.AddAttachment(@"C:\Documents and Settings\Administrator\My Documents\DOTNET中华网技术论坛--『C#_NET技术专题』 浏览:介绍一批C#的学习网站",true,"htm"); //附件
if(jmailobj.Send("mailserver.com",false)) {
//mailserver.com邮件服务器
Response.Write("ok");
}
else {
Response.Write("false");
} 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhongzhengfeng/archive/2008/10/14/3068075.aspx
你自己看到了 2006年11月以后注册的号没有pop协议,不能使用smtp发送
VS自带的mail类比较垃圾
**
** DotNet1.1环境下 Code CreateBy guofeng 2005.6.14
**
**********************************************************************/using System.Web.Mail;public void _Dotnet1.1SendMail()
{
strMessage = ""; //定义错误信息 MailMessage mailMsg = new MailMessage();
mailMsg.From = strMailFrom; mailMsg.To = strMailTo;
mailMsg.Subject = strMailTitle;
mailMsg.Priority = MailPriority.High; //邮件级别,.High、.Low、.Normal
mailMsg.BodyFormat = MailFormat.Text; //邮件形式,.Text、.Html
mailMsg.Body = strEmailBody; mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //设置支持服务器验证
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", strMailFrom); //设置用户名
mailMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", strPsd); //设置用户密码 SmtpMail.SmtpServer = strMailSMTP; //or SmtpMail.SmtpServer.Insert( 0, strMailSMTP);
try
{
//发送邮件
SmtpMail.Send( mailMsg );
}
catch( Exception Message )
{
strMessage = "发送失败" + Message.Message.ToString();
} if( strMessage != "" )
{
Response.Write(strMessage );
}
else
{
Response.Write("发送成功!");
}
}
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/abandonship/archive/2008/12/22/3580975.aspx