Asp.net mvc 如何在不使用smtp服务器的情况下从.net应用程序自动发送电子邮件?

Asp.net mvc 如何在不使用smtp服务器的情况下从.net应用程序自动发送电子邮件?,asp.net-mvc,razor,Asp.net Mvc,Razor,这是密码 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之外,还有其他方式发送电子邮件吗? 有没有办法通过http从应用程序

这是密码

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之外,还有其他方式发送电子邮件吗?
有没有办法通过http从应用程序发送电子邮件

不,这就是电子邮件的工作原理。就像你需要一个web服务器来服务网页一样,你也需要一个SMTP服务器来发送电子邮件。您必须与IT基础设施部门沟通,让他们为您设置一些内容,或者允许您尝试使用的任何SMTP服务器发出请求


如果您只需要测试发送电子邮件,您可以暂时使用类似的方法,然后根据您在生产环境中部署应用程序的位置和方式,这可能不再是一个问题。

先生,即使我们实验室的smtp服务器关闭,我仍然怀疑我如何能够看到我的gmail。嗯,第一次接收邮件通过不同的端口和不同的协议(IMAP或POP)工作。其次,有了Gmail,你很可能在网上看到它,在这种情况下,所有的协议都发生在谷歌服务器的幕后。您所做的只是通过端口80上的标准HTTP(S)协议发送接收位,这几乎是普遍允许的。
SmtpMail oMail = new SmtpMail("TryIt");
SmtpClient oSmtp = new SmtpClient();
//Set sender email address, please change it to yours
oMail.From = "yaswanthmdh@gmail.com";

//Set recipient email address, please change it to yours
oMail.To = "manojsr6@gmail.com";

//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 "gmailid@gmail.com", then the user should be the same
oServer.User = "yaswanthmdh@gmail.com";
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);
}