spring-framework / org.springframework.mail.javamail / JavaMailSenderImpl / setUsername

setUsername

open fun setUsername(@Nullable username: String): Unit

Set the username for the account at the mail host, if any.

Note that the underlying JavaMail Session has to be configured with the property "mail.smtp.auth" set to true, else the specified username will not be sent to the mail server by the JavaMail runtime. If you are not explicitly passing in a Session to use, simply specify this setting via #setJavaMailProperties.

See Also
#setSession#setPassword