Preloader image
DDD

자바

Gmail - Must issue a STARTTLS command first.

작성자 관리자 (admin)
조회수 520
입력일 2023-05-23 15:04:29

- Error

250 2.1.5 Flushed br3-20020a17090b0f0300b0024e11f31012sm6836902pjb.5 - gsmtp
DEBUG SMTP: MessagingException while sending, THROW: 
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. br3-20020a17090b0f0300b0024e11f31012sm6836902pjb.5 - gsmtp

    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2108)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1609)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1117)
    at javax.mail.Transport.send0(Transport.java:195)
    at javax.mail.Transport.send(Transport.java:124)
    at com.blz.dia.cmm.function.TestMail.main(TestMail.java:89)
QUIT
221 2.0.0 closing connection br3-20020a17090b0f0300b0024e11f31012sm6836902pjb.5 - gsmtp

- Java

        // Create properties, get Session
        Properties props = new Properties();
        
        props.put("mail.smtp.starttls.enable", "true"); // 추가하면 해결
        props.put("mail.smtp.host", host);
        props.put("mail.smtp.port", "587");
        props.put("mail.debug", "true");

 

 

^