인증 방식
🔑 API Key
요금
월 100건 무료, 이후 Essentials $14.95/월~
Base URL
api.sendgrid.com/v3
태그
이메일, SendGrid
서비스 소개
SendGrid는 트랜잭션 이메일(회원가입 인증, 비밀번호 재설정, 주문 확인 등) 발송에 가장 널리 사용되는 서비스입니다. 월 100건 무료, 이후 저렴한 요금으로 안정적인 이메일 전송률(>99%)을 제공합니다. 이메일 템플릿, 열람률·클릭률 분석도 지원합니다.
🚀 시작하기
- 1
SendGrid 가입
signup.sendgrid.com → 무료 계정 생성
- 2
발신 도메인 인증
Settings → Sender Authentication → 도메인 DNS 인증 (스팸 방지)
- 3
API 키 발급
Settings → API Keys → Create API Key → Full Access 또는 Restricted
- 4
SDK 설치
npm install @sendgrid/mail 또는 pip install sendgrid
💡 코드 예제
JavaScriptNode.js
import sgMail from '@sendgrid/mail'
sgMail.setApiKey(process.env.SENDGRID_API_KEY!)
// 단순 이메일
await sgMail.send({
to: 'user@example.com',
from: 'noreply@yourdomain.com', // 인증된 발신자
subject: '회원가입을 환영합니다!',
text: '가입해주셔서 감사합니다.',
html: '<strong>가입해주셔서 감사합니다!</strong>',
})
// 다이나믹 템플릿 사용
await sgMail.send({
to: 'user@example.com',
from: 'noreply@yourdomain.com',
templateId: 'd-xxxxxxxxxxxx',
dynamicTemplateData: {
name: '홍길동',
verifyUrl: 'https://yourdomain.com/verify?token=...',
},
})PythonPython
import sendgrid
from sendgrid.helpers.mail import Mail
sg = sendgrid.SendGridAPIClient(api_key="YOUR_API_KEY")
message = Mail(
from_email="noreply@yourdomain.com",
to_emails="user@example.com",
subject="회원가입 인증 메일",
html_content="<strong>인증 링크를 클릭하세요</strong>",
)
sg.send(message)