まず、私が追加/修正した項目は次のとおりです。/etc/postfix/main.cf文書:
mydomain = domain.com
myorigin = $mydomain
relayhost = email-smtp.us-east-1.amazonaws.com:25
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl/amazon-ses
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtp_use_tls = yes
smtp_tls_security_level = encrypt
smtp_tls_note_starttls_offer = yes
header_checks = regexp:/etc/postfix/header_checks
これでテストメールを送ると...
$ sudo sendmail [email protected]
To: [email protected]
From: [email protected]
Subject: Test email!
This is just a test email.
.
メールログを確認してください(/var/log/mail.log)、私はこれを見る:
Feb 17 04:23:16 hostname postfix/pickup[6226]: B3DD4137ED: uid=0 from=<root>
Feb 17 04:23:16 hostname postfix/cleanup[6230]: B3DD4137ED: replace: header From: [email protected] from local; from=<[email protected]> to=<[email protected]>: From: "WebsiteName Alerts (no reply)" <[email protected]>
Feb 17 04:23:16 hostname postfix/cleanup[6230]: B3DD4137ED: message-id=<[email protected]>
Feb 17 04:23:16 hostname postfix/qmgr[6144]: B3DD4137ED: from=<[email protected]>, size=353, nrcpt=1 (queue active)
Feb 17 04:23:18 hostname postfix/smtp[6232]: B3DD4137ED: to=<[email protected]>, relay=email-smtp.us-east-1.amazonaws.com[107.22.250.234]:25, delay=25, delays=24/0.03/0.93/0.58, dsn=2.0.0, status=sent (250 Ok 0000013ce6644ae6-69927d25-c4e1-4f25-8ad4-b85b59318e84-000000)
Feb 17 04:23:18 hostname postfix/qmgr[6144]: B3DD4137ED: removed
ご覧のとおり、ログが表示され、[email protected]
コマンドで具体的に述べた[email protected]
ようにfrom
見えます。[email protected]
sendmail
私の修正にもかかわらず/etc/エイリアス次のファイル:
# /etc/aliases
mailer-daemon: [email protected]
postmaster: [email protected]
nobody: [email protected]
hostmaster: [email protected]
usenet: [email protected]
news: [email protected]
webmaster: [email protected]
www: [email protected]
ftp: [email protected]
abuse: [email protected]
noc: [email protected]
security: [email protected]
root: [email protected]
では、問題は[email protected]
システムのデフォルトのメールアドレスをどのように設定しますか?つまり、rootユーザーのEメールアドレス[email protected]
をからどのように変更しますか[email protected]
?
これが重要な場合、私のシステムはDebian 7(Wheezy)64ビットを実行しています。
答え1
ユーザー名とドメインの組み合わせに加えて、デフォルトの返信メールアドレスはありません。 sudo を使用して sendmail を呼び出すと、root
ユーザー名を使用してエンベロープ返信アドレスを生成します。この動作を変更するには、-f
sendmail でスイッチを使用します。
-fname Sets the name of the ``from'' person (i.e., the envelope sender
of the mail). This address may also be used in the From: header
if that header is missing during initial submission. The enve‐
lope sender address is used as the recipient for delivery status
notifications and may also appear in a Return-Path: header. -f
should only be used by ``trusted'' users (normally root, daemon,
and network) or if the person you are trying to become is the
same as the person you are. Otherwise, an X-Authentication-
Warning header will be added to the message.