インストール済みパッケージ(postfix,saslでsearch)
postfix
libsasl2-2
libsasl2-modules
↑これがないと"no mechanism available"エラーが発生する
dpkg-reconfigure postfix
サテライトを選択
main.cf
smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:パスワードマップファイルパス smtp_sasl_security_options = noanonymous smtp_sasl_mechanism_filter = LOGIN, PLAIN
上の4行を追加
relayhost = [メールサーバURL]:ポート番号
relayhostを上の様に変更
smtp_sasl_mechanism_filterについて
以下に示す場所を参照して設定する
$ telnet メールサーバURL ポート番号 Trying xxx.xxx.xxx.xxx Connected to メールサーバURL Escape character is '^]'. 220 メールサーバURL ESMTP ehlo てきとーなアドレス 250-メールサーバURL Hello 接続元逆引き[yyy.yyy.yyy.yyy], pleased to meet you 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 10240000 250-DSN 250-AUTH LOGIN PLAIN <-------ここを参照 250-STARTTLS 250-DELIVERBY 250 HELP quit 221 2.0.0 メールサーバURL closing connection Connection closed by foreign host.
パスワードマップファイル
[メールサーバURL]:ポート番号 ユーザーID:パスワード
postmap パスワードマップファイルパス
送信方法
あて先はGmailだと成功した
echo メール本文 | mail あて先
or
sendmail -t < testmail
testmail内容
To: あて先 From: 適当なメールアドレス Subject: 件名 本文