-
-
Notifications
You must be signed in to change notification settings - Fork 275
Closed
Labels
Milestone
Description
Hello! I faced some problem using Simple Java Mail, version 7.5.1, about the prop username.
When passing the prop username, Jakarta Mail does not recognize it. Debugging the code, I found this: in class org.simplejavamail.api.mailer.config.TransportStrategy line 104:
public String propertyNameUsername() {
return "mail.smtp.username";
}
On the other hand, in jakarta, class jakarta.mail.Service, line 112:
if (protocol != null) {
if (host == null)
host = session.getProperty("mail." + protocol + ".host");
if (user == null)
user = session.getProperty("mail." + protocol + ".user");
}
Simple Mail uses mail.smtp.username, but Jakarta uses mail.smtp.user. Furthemore, I faced an exception about authentication.
To solve this, I found two ways:
public enum TransportStrategy {
....
public String propertyNameUsername() {
return "mail.smtp.user";
}
Properties props = new Properties();
props.put("mail.smtp.user", "any_user");
MailerImpl mailer = (MailerImpl) MailerBuilder
....
.withProperties(props)
.buildMailer();
So is this problem or is it an error I am causing?
Thanks in advance!