通过使用JavaMail API,通过Web服务器发送邮件是否需要SMTP服务器? [英] Is SMTP server required to send mail through web server, by using JavaMail API?

查看:302
本文介绍了通过使用JavaMail API,通过Web服务器发送邮件是否需要SMTP服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SMTP服务器是否需要使用JavaMail API通过Web服务器发送邮件?
当我使用 localhost 发送邮件时,它可以正常工作,但是当我将其上传到服务器上时,它不起作用并给出错误:

Is a SMTP server required to be able to send mail through a web server, by using JavaMail API? When I am using localhost for sending mail, it works, but when I upload it on server it doesnt work and gives error:


没有这样的smtp提供者

No such smtp provider

我该如何解决? p>

How can I solve this?

推荐答案

SMTP服务器始终需要能够发送电子邮件,就像HTTP服务器总是需要能够发送网页。这是不管您使用的网站和邮件API。 HTTP服务器不一样,通常不包括SMTP服务器。

A SMTP server is always required to be able to send emails, like as a HTTP server is always required to be able to send webpages. This is regardless of the website and the mail API you're using. A HTTP server is not the same as and does usually not include a SMTP server.

您可以使用与您自己现有的电子邮件帐户关联的SMTP服务器,例如您的ISP或公共邮箱(如Gmail,Yahoo等)。您可以在其文档中找到SMTP连接详细信息。你通常只需要知道主机名和端口号。登录详细信息与您的电子邮件帐户相同。

You could make use of the SMTP server associated with your own existing email account, such as the one from your ISP or public mailboxes like Gmail, Yahoo, etc. You can find SMTP connection details at their documentation. You usually just need to know the hostname and the port number. The login details are just the same as from your email account.

随着ISP /公共邮箱的限制,您只能在<$ c中使用您自己的地址$ c>从字段的电子邮件,通常也是您允许以一定的间隔发送的电子邮件数量。如果您想要解决此问题,那么您需要安装自己的SMTP服务器,例如 Apache James ,它是基于Java的,或Microsoft Exchange等。

With the ISP/public mailboxes you're however restricted to using only your own address in the From field of the email and usually also in the amount of emails you're allowed to send at certain intervals. If you'd like to get around this, then you need to install your own SMTP server, for example Apache James, which is Java based, or Microsoft Exchange and so on.

一旦拥有SMTP服务器,您就可以使用 JavaMail API 或最终更易于使用的 Apache Commons Email

Once you have a SMTP server, then you'll be able to send emails using the JavaMail API or eventually the more convenienced Apache Commons Email.

我忘了添加,如果您使用第三方网络托管,那么很高兴大多数第三方网络托管服务商也提供SMTP服务器。您想查询主机功能,并在其文档中绘制连接细节。

I forgot to add, if you're using 3rd party web hosting, then it's good to know that most of those 3rd party web hosting providers also offers a SMTP server as well. You'd like to consult the hosting features and figure the connection details in their documentation.

这篇关于通过使用JavaMail API,通过Web服务器发送邮件是否需要SMTP服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆