This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / Send email through ASP .NET?I created a ASP .NET application and used System.Net.Mail class to send email by connecting to GMAIL.SMTP.COM. Everything works fine at home, but when I ran same code at work place, it showed me the error "The connection was aborted by the host machine..."
What's the cause? Is something related to firewall or SMTP config in IIS or other reasons?
-ttaaoo(tao);
2008-6-2
{353}
(#4480088@0)
-
Could someone help on this? Thanks.
-ttaaoo(tao);
2008-6-2
(#4480102@0)
-
It's probably that your machine has antivirus software.
-readonly(ReadOnly);
2008-6-2
(#4480397@0)
-
typically, a corpoate network won't allow such a connection initiated from an internal box to an external wel-known service port (except port 80 or 443). It's the firewall, I guess...
-bluebison(不是很牛);
2008-6-2
(#4480424@0)
-
查web.config, 看authorization和impersonate. 根据具体情况, 或者增加ASP.NET帐户的权限, 或者改用windows authorization.
-javacup(风铃);
2008-6-2
(#4480462@0)
-
For security reason, most companies disable SMTP of local desktops. The emails are sent out from central mail server (via firewall system).You can ask your system admin about your mail server and try following:
SmtpClientObj.Host = Mail Server IP (or Mail Server Name);
You may also need to provide Credentials data for SmtpClient object like following:
SmtpClientObj.Credentials = new System.Net.NetworkCredential(uid, password, domain);
-deep_blue(BLUE);
2008-6-3
{322}
(#4480893@0)
-
funny so many people give you different solution and they all might be right, but the key issue they didn't say is how to troubleshoot it and find the real problem?in your case, what you need to do is start a cmd in your company machine, type in
telnet gmail.smtp.com 25
now you see you can't connect, and if you try
telnet smtp.gmail.com 25
you can connect.
-holdon(again);
2008-6-3
{209}
(#4480963@0)
-
telnet might not worktelnet usally diabled these days.. i bet google did that too.
-sunday8(sunday8);
2008-6-3
{61}
(#4481036@0)
-
I bet you are wrong. Google didn't do that. You should do a test first:telnet SMTP.gmail.COM 25
I am not saying you can connect for sure ( cause you might have your internal firewall), but google is open its port 25 ( of couse, to allow people use its smtp service.)
-holdon(again);
2008-6-3
{198}
(#4481654@0)
-
i just tried.. failed..Could not open connection to the host..
-sunday8(sunday8);
2008-6-3
(#4482477@0)
-
you are probably with rogers, which block port 25. you can check http://www.t1shopper.com/tools/port-scanner/put smtp.gmail.com and port 25 in, you can see it's responding.
-holdon(again);
2008-6-3
{64}
(#4482500@0)
-
Your method can't tell where the problem is.
-readonly(ReadOnly);
2008-6-3
(#4481078@0)
-
what I mean is you should do test before make conclusion:
-holdon(again);
2008-6-3
{909}
(#4481696@0)
-
纸上谈兵,自以为是。就没可能问题在server上? 比如 1: smtp service is down; 2: Anti-virus software blocks port 25.
-readonly(ReadOnly);
2008-6-3
(#4482520@0)
-
yes, anything could go wrong, that's the reason you should check it step by step, not make guess in vain.
-holdon(again);
2008-6-3
(#4482531@0)
-
open port 587 on the firewall
-benbendan(相忘于江湖);
2008-6-3
(#4482550@0)