# django email ## 설정 GMail SMTP 서버 GMail의 SMTP 서버를 이용하기 위해서는 두 가지 설정을 해줘야한다 - [다른 이메일 클라언트에서 GMail을 확인할 수 있도록 IMAP 사용 설정](https://support.google.com/mail/answer/7126229?hl=ko&rd=3&visit_id=1-636281811566888160-3239280507#ts=1665018) - [보안 수준이 낮은 앱 및 Google 계정 허용](https://support.google.com/mail/answer/7126229?hl=ko&rd=3&visit_id=1-636281811566888160-3239280507#ts=1665018) ## 코드 ```python from django.core.mail import send_mail send_mail( 'Subject here', 'Here is the message.', 'from@example.com', ['to@example.com'], fail_silently=False, ) ``` ```python from django.core.mail import EmailMessage email = EmailMessage( 'Hello', 'Body goes here', 'from@example.com', ['to1@example.com', 'to2@example.com'], ['bcc@example.com'], reply_to=['another@example.com'], headers={'Message-ID': 'foo'}, ).send() ``` ## 출처 - https://docs.djangoproject.com/en/2.2/topics/email/ - https://velog.io/@ground4ekd/django-send-mail