본문 바로가기

BACK

[SpringBoot JSP] - gmail 보내기 & 설정 (Intellij)

728x90

1. Google 홈페이지 > Google 계정 관리(우측상단)

 

2. 보안 > 앱 비밀번호 ..

 

3. 메일, Windows 컴퓨터

 

4. 앱 비밀번호 저장 (smtp 설정에 사용될 예정)

 

5. 빠른 설정(우측상단 톱니바퀴) → 모든 설정 보기

 

6. 전달 및 POP/IMAP(탭) -> 모든 메일에 POP사용하기 -> IMP사용 -> 변경사항 저장

 

7. gradle 방식 -> bulid.gradle

implementation 'org.springframework.boot:spring-boot-starter-mail:2.6.3'

  maven 방식 -> pom.xml

<dependency>
	<groupId>org.springframwork.boot</groupId>
    <artifactId>spring-boot-starter-mail</artifactId>
</dependency>

 

8. SMTP 설정

application.properties 방식

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

application.yml  방식

mail:
  host: smtp.gmail.com
  port: 587
  username: gmail 아이디
  password: 앱 비밀번호
  properties:
    mail:
      smtp:
        auth: true
        timeout: 5000
        starttls:
          enable: true

 

728x90