티스토리 뷰

공부

[java] send email auth

승가비 2022. 9. 11. 20:13
728x90
val msg = MimeMessage(
    Session.getDefaultInstance(
        props,
        object : Authenticator() {
            override fun getPasswordAuthentication(): PasswordAuthentication {
                return PasswordAuthentication(ID, PW)
            }
        }
    )
)

https://stackoverflow.com/questions/6610572/javax-mail-authenticationfailedexception-failed-to-connect-no-password-specifi

 

javax.mail.AuthenticationFailedException: failed to connect, no password specified?

This program attempts to send e-mail but throws a run time exception: javax.mail.AuthenticationFailedException: failed to connect, no password specified? Why am I getting this exception when I have

stackoverflow.com

Transport.send(msg, "user", "password");
728x90
댓글