2014年5月18日日曜日

Raspberry Piセットアップ日記(8)Gmailでメール送信

●Gmailでメール送信
ssmtpを使う

1、ssmtpのインストール
$ sudo apt-get install ssmtp
2、ssmtpの設定
$ sudo vi /etc/ssmtp/ssmtp.conf 
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
#root=postmaster

# 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=Gmailのアカウント名
AuthPass=Gmailのパスワード
AuthMethod=LOGIN
UseSTARTTLS=YES
UseTLS=Yes
3、送信テスト
$ vi mailtest.txt
From:gmailのメールアドレス
To:あて先メールアドレス
Subject:test

Mail Test
$ sendmail -t < mailtest.txt

●参考
ラズベリーパイ(raspbian)を使ってみる - 5分でメールを送信できるようにする -

0 件のコメント:

コメントを投稿