[Spring] Mail Authentication AuthenticationFailedException

JohnΒ·2023λ…„ 5μ›” 27일
0

μ—λŸ¬ λ©”λͺ¨πŸ₯€

λͺ©λ‘ 보기
6/9
post-thumbnail

Gmail SMTPλ₯Ό μ΄μš©ν•œ 이메일 전솑기λŠ₯이 μ‹€νŒ¨ν•˜λ©° μ—λŸ¬κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.
ν•΄λ‹Ή μ—λŸ¬μ— λŒ€ν•΄ μ•Œμ•„λ³΄κ² μŠ΅λ‹ˆλ‹€.


μ—λŸ¬λ‘œκ·Έ

Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8  https://support.google.com/mail/?p=BadCredentials 10-20020a63104a000000b0051806da5cd6sm2439853pgq.60 - gsmtp

뢄석

λ‘œκ·Έμ— λ‚˜μ™€μžˆλŠ” 링크 https://support.google.com/mail/?p=BadCredentials 둜 접속을 ν–ˆμ„ λ•Œ μ•„λž˜μ™€ 같은 λ‚΄μš©μ„ 확인할 수 μžˆμŠ΅λ‹ˆλ‹€.

2단계 인증을 μ‚¬μš©ν•˜λŠ” 경우 μ•± λΉ„λ°€λ²ˆν˜Έλ‘œ 둜그인이 ν•„μš”ν•©λ‹ˆλ‹€.

application.yml

...

mail:
  host: smtp.gmail.com
  port: 587
  username: your_email
  password: app_password
  properties:
    mail:
      smtp:
        starttls:
          enable: true
          
...

password 값을 μ•± λΉ„λ°€λ²ˆν˜Έλ‘œ λ³€κ²½ν•˜κΈ° μœ„ν•΄ μ•„λž˜ μž‘μ—…μ„ μ§„ν–‰ν•˜κ² μŠ΅λ‹ˆλ‹€.

  1. ꡬ글 계정에 λ“€μ–΄κ°€ 2단계 인증을 μΆ”κ°€ν•©λ‹ˆλ‹€.
  2. μΆ”κ°€ 이후 2단계 인증을 눌러 μ„ΈλΆ€ ν•­λͺ©μ— λ“€μ–΄κ°‘λ‹ˆλ‹€.

  1. ν•˜λ‹¨μ— μ•± λΉ„λ°€λ²ˆν˜Έλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€.
  2. application.yml νŒŒμΌμ— passwordν•­λͺ©μ— μ•± λΉ„λ°€λ²ˆν˜Έλ₯Ό μž…λ ₯ν•©λ‹ˆλ‹€.

정상 μž‘λ™λ¨μ„ ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€.

profile
기둝을 μŠ΅κ΄€μœΌλ‘œ

0개의 λŒ“κΈ€