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
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…