LoginSignup
8
8

More than 5 years have passed since last update.

Raspberry Pi2でgmailを送信

Posted at

Raspberry Pi2でgmailを送信するための手順メモ
メールは、sSMTPを利用する。

用意したもの

  1. 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
8
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
8