从amazon服务器发送电子邮件时发生javax.mail异常

时间:2022-10-23 18:55:41

I have a simple standalone java class that sends out the emails. I'm using javax.mail to send my emails.

我有一个简单的独立java类发送电子邮件。我正在使用javax.mail发送我的电子邮件。

When I run the class on Window machine it is working fine. When I ran the same class on Amazon Server it is giving below exceptions:

当我在Window机器上运行它时它工作正常。当我在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 e.g. 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.

提前致谢。

1 个解决方案

#1


0  

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. Maybe you were in the local network of that server, maybe the server is run by your ISP.

我不知道为什么它适用于您的Windows机器。也许您在该服务器的本地网络中,也许服务器由您的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.

当然,您需要服务器的用户和密码,您必须与运行该服务器的任何人交谈。

#1


0  

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. Maybe you were in the local network of that server, maybe the server is run by your ISP.

我不知道为什么它适用于您的Windows机器。也许您在该服务器的本地网络中,也许服务器由您的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.

当然,您需要服务器的用户和密码,您必须与运行该服务器的任何人交谈。