0
In my lab smtp server is blocked.I had gone through the EAsendmail package but i couldn't succeed in sending email from the application directly without using going through smtp server.
這裏是運行此代碼我收到超時錯誤後的代碼如何在不使用smtp服務器的情況下自動從.net應用程序發送電子郵件?
SmtpMail oMail = new SmtpMail("TryIt");
SmtpClient oSmtp = new SmtpClient();
//Set sender email address, please change it to yours
oMail.From = "[email protected]";
//Set recipient email address, please change it to yours
oMail.To = "[email protected]";
//Set email subject
oMail.Subject = "direct email sent from c# project";
//Set email body
oMail.TextBody = "this is a test email sent from c# project directly";
//Set SMTP server address to "".
SmtpServer oServer = new SmtpServer("");//173.194.40.246,"74.125.237.181");
//Set 465 port
oServer.Port = 465;
//detect SSL/TLS automatically
oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;
//Gmail user authentication
//For example: your email is "[email protected]", then the user should be the same
oServer.User = "[email protected]";
oServer.Password = "";
try
{
Console.WriteLine("start to send email directly ...");
oSmtp.SendMail(oServer, oMail);
Console.WriteLine("email was sent successfully!");
}
catch (Exception ep)
{
Console.WriteLine("failed to send email with the following error:");
Console.WriteLine(ep.Message);
}
。 有沒有其他方式發送電子郵件,而不是通過smtp? 有沒有辦法通過http發送應用程序的電子郵件?
先生,我懷疑即使在我們的實驗室smtp服務器已關閉,那麼我怎麼能夠看到我的Gmail。 – raja
那麼,首先*接收*郵件工作在不同的端口和不同的協議(IMAP或POP)。其次,對於Gmail,很可能您正在網上查看它,在這種情況下,所有協議都會在Google服務器的幕後發生。你所做的只是通過端口80上的標準HTTP(S)協議發送一個接收位,這將允許非常普遍的。 –