概述
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)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复