# 원인 : 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
하면 에러 없이 잘 전송됨.

'개발 > Spring Framework' 카테고리의 다른 글
[ChatGpt]에게 끊임 없이 물어본 VO, DTO의 개념 (2) | 2023.03.21 |
---|---|
[Spring] @Scheduled 이란? (0) | 2022.12.06 |
[Mybatis] SqlSessionTemplate , MapperInterface (0) | 2022.12.01 |
[Mybatis] 마이바티스 parameterType와 resultType차이 (0) | 2022.11.25 |
[springFramework] mapUnderscoreToCamelCase (0) | 2022.11.25 |