我是靠谱客的博主 甜美皮带,这篇文章主要介绍smtp java,JavaMail smtp属性(适用于STARTTLS),现在分享给大家,希望可以做个参考。

JavaMail specifies a bunch of properties that can be set to configure an SMTP connection. To use STARTTLS it is necessary to set the following property

mail.smtp.starttls.enable=true

Where do I specify the username/password to use the smtp service? Is it enough to specify the:

mail.smtp.user=me

mail.smtp.password=secret

Or do I have to explicitely login using the:

transport.connect(server, userName, password)

Yes, I already tried to do this and it seems that it is necessary to connect using transport.connect(..). But if yes, what are the mail.smtp.user & pass properties for? Are they not enough to use smtp with starttls?

解决方案

Here is my sendEmail method which is using GMail smtp (JavaMail) with STARTTLS

public void sendEmail(String body, String subject, String recipient) throws MessagingException,

最后

以上就是甜美皮带最近收集整理的关于smtp java,JavaMail smtp属性(适用于STARTTLS)的全部内容,更多相关smtp内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(88)

评论列表共有 0 条评论

立即
投稿
返回
顶部