using System.Web.Mail;
myMail.From = "[email protected]";
myMail.To = "[email protected]";
myMail.Subject = "MailTest";
myMail.Priority = MailPriority.Low;
myMail.BodyFormat = MailFormat.Text;
myMail.Body = "Test";
SmtpMail.SmtpServer = "mail.163.com";
SmtpMail.Send(myMail);
myMail.From = "[email protected]";
myMail.To = "[email protected]";
myMail.Subject = "MailTest";
myMail.Priority = MailPriority.Low;
myMail.BodyFormat = MailFormat.Text;
myMail.Body = "Test";
SmtpMail.SmtpServer = "mail.163.com";
SmtpMail.Send(myMail);
using System.Web.Mail;myMail.To = "[email protected]";
myMail.Subject = "MailTest";
myMail.Priority = MailPriority.Low;
myMail.BodyFormat = MailFormat.Text;
myMail.Body = "Test";
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send(myMail);建议你用jmail,webeasymail,cdo等。
private void Page_Load(object sender, System.EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To = "[email protected]";
mail.From = "[email protected]";
mail.Subject = "this is a test email.";
mail.Body = "Some text goes here";
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); //set your password here SmtpMail.SmtpServer = "mail.mycompany.com"; //your real server goes here
SmtpMail.Send( mail );
}
using System.Web.Util;
using System.Web.Mail;
Message jmailobj=new Message();
jmailobj.Logging=true;
jmailobj.Silent=true;
jmailobj.MailServerUserName="8888"; //发信邮件服务器的帐号
jmailobj.MailServerPassWord="8888"; //密码
jmailobj.Body="ok";
jmailobj.Charset="gb2312";
jmailobj.Subject="这个是JMAIL测试!";
jmailobj.From="[email protected]";
jmailobj.FromName="test";
jmailobj.AddRecipient("[email protected]","Name","A"); //收件人地址
jmailobj.Priority =1;
if(jmailobj.Send("smtp.163.com",false))
{
Response.Write("ok");
}
else
{
Response.Write("false");
}
注意 可能还跟杀毒软件有关,要关了杀毒软件防火墙之类的东西!
我用C#写的支持smtp验证的邮件组件,
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "my_username_here"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "super_secret"); //set your password here