我是靠谱客的博主 甜美皮带,最近开发中收集的这篇文章主要介绍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 java,JavaMail smtp属性(适用于STARTTLS)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部