IT'S DO
article thumbnail
728x90

# 원인 : Spring의 JavaMailSender를 사용할 때,  구글 계정을 이용해 메일을 보낼려고 할때 나타나는 에러.

기존에는 메일 발송하기 위해 아이디, 비밀번호만 필요했다면. 2022년 5월 30일 부터 보안 수준 낮은 앱을 지원하지 않음.

https://support.google.com/accounts/answer/6010255

 

보안 수준이 낮은 앱 및 Google 계정 - Google 계정 고객센터

2025년 1월부터 보안 수준이 낮은 앱, 서드 파티 앱 또는 사용자 아이디와 비밀번호만으로 로그인하는 기기는 더 이상 Google Workspace 계정에서 지원되지 않습니다. 정확한 날짜는 Google Workspace 업데

support.google.com

 

# 해결 방법:

1. 메일을 발송하는 계정으로 로그인 후에  보안 탭에서

- 2단계 인증이 사용 중지되었다는 것을 -> 사용 완료

 

 

2. 

https://support.google.com/mail/answer/185833?hl=en

 

Sign in with app passwords - Gmail Help

Important: App passwords aren’t recommended and are unnecessary in most cases. To help keep your account secure, use "Sign in with Google" to connect apps to your Google Account. An app password is a 16-digit passcode that gives a less secure app or devi

support.google.com

Create and manage your app passwords (위의 링크 내용에서 앱 비밀번호를 만들고 관리하세요) 선택. -> 앱 비밀번호 설정 후 -> 복사 및 기억하기

 

3. application.yml

spring: 
  mail:
      host: smtp.gmail.com
      port: 587
      username: username
      password: 앱 비밀번호
      protocol: smtp
      properties:
        mail:
          smtp:
            auth: true
            starttls:
              enable: true

 

하면 에러 없이 잘 전송됨.

profile

IT'S DO

@멋진놈

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!