gmail smtp 发送邮件的问题
各位大家好,我在尝试使用 SMTP+MAILMESSAGER发送邮件的时候,在国内如163的smtp服务器可以很好的达到发送的效果,但在尝试国外的服务器,如hotmail时,被告之需要MONEY才能使用这个服务。
在使用GMAIL的效果时,仍然不能发送信件。我的代码如下:
public void Datagmail()
{
MailMessage mail = new MailMessage();
mail.To = "kid_eve@hotmail.com";
mail.From = "kideve820523@gmail.com";
mail.Subject = "this is a test email gamil.";
mail.Body = "Some text goes here";
SmtpMail.SmtpServer = "smtp.gmail.com"; //your real server 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", "kideve820523@gmail.com"); //set your username here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "820523"); //set your password here
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465");//设置端口号
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "false");//set SSL Use
//SmtpMail.SmtpServer = "smtp.gmail.com";
SmtpMail.Send( mail );
}
在测试了2个发送端口后,仍然显示 与服务器的传输连接失败,我使用OUTLOOK测试,可以收邮件,仍然不能发送,小弟实在不知道是怎么回事,特此请教,请有此类遭遇与经验的朋友大方出手,谢谢。