More Related Content
Similar to SendGridを使ってみよう (20)
More from Shuichi Yukimoto (13)
SendGridを使ってみよう
- 6. # -*- coding: utf-8 -*-
import smtplib
from email.mime.text import MIMEText
from email.header import Header
con = smtplib.SMTP('smtp.sendgrid.net', 587)
con.esmtp_features['auth'] = 'LOGIN'
con.login('登録したアカウント', 'パスワード')
con.set_debuglevel(True)
cset = 'utf-8'
message = MIMEText(u'日本語のメール送ってみました', 'plain', cset)
message['Subject'] = Header(u'送信テスト', cset)
message['From'] = 'from@example.com'
message['To'] = 'to@example.com'
con.sendmail('from@example.com',
['yukimoto@usa-mimi.jp'], message.as_string())
con.close()
SendGridでメール送信(python)
- 19. • POSTされるパラメータは次の通り
• charsets …それぞれのパラメータの文字コード
• to … 送信先
• subject … タイトル
• from …送信元
• text/html … 本文
• headers … ヘッダ
• attachments … 添付ファイル
• envelope … エンベロープ
• sender_ip … 送信元IPアドレス
• dkim … 認証結果
• SPF … 認証結果