简体   繁体   English

从亚马逊服务器发送电子邮件时出现javax.mail异常

[英]javax.mail exception while sending a email from amazon server

I have a simple standalone java class that sends out the emails. 我有一个简单的独立Java类,可以发送电子邮件。 I'm using javax.mail to send my emails. 我正在使用javax.mail发送我的电子邮件。

When I run the class on Window machine it is working fine. 当我在Window计算机上运行该类时,它运行良好。 When I ran the same class on Amazon Server it is giving below exceptions: 当我在Amazon Server上运行相同的类时,它给出以下异常:

Exception in thread "main" javax.mail.MessagingException: Could not connect to SMTP  host: smtpout.secureserver.net, port: 25, response: 554
554 *.phx3.secureserver.net  ESMTP No Relay Access Allowed From xxx.xxx.xxx.xxx

I tried to find help online. 我试图在线寻求帮助。 for eg by execution below command 例如通过以下命令执行

nc -z -v smtpout.secureserver.net 25
Connection to smtpout.secureserver.net 25 port [tcp/smtp] succeeded!

Please help me. 请帮我。

Thanks in advance. 提前致谢。

It seems you are trying to use the server smtpout.secureserver.net to send mail to an address not hosted by that server, asking the server to relay that mail. 似乎您正在尝试使用服务器smtpout.secureserver.net将邮件发送到该服务器未托管的地址,要求服务器中继该邮件。

Since services like that are used by spammers to hide behind, nearly all servers block this, unless the server knows you, either because you are in his network (which you are not), or because you authenticate yourself. 由于垃圾邮件发送者使用了诸如此类的服务来躲藏,因此几乎所有服务器都会阻止此操作,除非该服务器知道您,要么是因为您在他的网络中(不是),要么是您对自己进行了身份验证。

I don't know why it worked with your windows machine. 我不知道为什么它可以在您的Windows机器上使用。 Maybe you were in the local network of that server, maybe the server is run by your ISP. 也许您在该服务器的本地网络中,或者该服务器由ISP运行。

Here is an example on how to use smtp authentication: http://www.rgagnon.com/javadetails/java-0538.html 这是有关如何使用smtp身份验证的示例: http : //www.rgagnon.com/javadetails/java-0538.html

Of course you need an user and password for the server, you have to talk to whoever runs that server for that. 当然,您需要服务器的用户名和密码,并且必须与运行该服务器的任何人交谈。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM