email - Set anonymous authentication into setJavaMailProperties in Spring -
i'm trying send email spring, received exception
mail server connection failed; nested exception javax.mail.messagingexception: not connect smtp host: host, port: 25; nested exception is: java.net.connectexception: connection refused: connect. failed messages: javax.mail.messagingexception: not connect smtp host: mailhub, port: 246; nested exception is: java.net.connectexception: connection refused: connect
caused connection refused.
for this, need set the connection anonymous authentication
right now, have this
@configuration public class mailconfig { @value("mailhost") private string host; @value("25") private integer port; @bean public javamailsender javamailservice() { javamailsenderimpl javamailsender = new javamailsenderimpl(); javamailsender.sethost(host); javamailsender.setport(port); javamailsender.setjavamailproperties(getmailproperties()); return javamailsender; } private properties getmailproperties() { properties properties = new properties(); properties.setproperty("mail.transport.protocol", "smtp"); properties.setproperty("mail.smtp.auth", "false"); properties.setproperty("mail.smtp.starttls.enable", "false"); properties.setproperty("mail.debug", "false"); return properties; } }
is there way implement anonymous authentication property?
Comments
Post a Comment