Raspberry Pi2でgmailを送信するための手順メモ
メールは、sSMTPを利用する。
用意したもの
- Raspberry Pi2(Raspbian 8.0)
インストール
ターミナル
$sudo apt-get install ssmtp
設定ファイルは、以下のように行う
/etc/ssmtp/ssmtp.conf
root=me@gmail.com
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.gmail.com:587
# Where will the mail seem to come from?
#rewriteDomain=
# The full hostname
hostname=raspberrypi
# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES
AuthUser=me@gmail.com
AuthPass=password
UseSTARTTLS=YES
root, AuthUser, AuthPassは、各自の設定を記入
メール送信
テキスト編集
~/develop/mail/mail
From:me@gmail.com <- 何を指定しても関係ない
To:宛先のメールアドレス
Subject: Test-Subject
Test-Massage
メール送信
ターミナル
$sendmail -t < ~/develop/mail/mail