
プロセスを自動化したいときに特定の条件が満たされたら、次のコマンドを使用して自動メールでユーザーに通知したいと思います。郵便注文する。
問題は、メッセージが送信されないことです。私が理解したところによれば、まずいくつかの設定を完了する必要があります。
問題は私が行く時です。
sudo dpkg-reconfigure postfix
修正するには、そこに何を記入するのかわかりません。
- 1 - 最初のページでシステムの電子メール名を尋ねます。
- 2 - ルートおよびポストマスターメール受信者の2番目の要求
- 3 - メールを受信するためのその他の宛先
- 4 - メールキューの強制同期はい/いいえ
- 5 - ローカルネットワーク(事前入力済み)
- 6 - メールボックスサイズ
- 7 - ローカルアドレス拡張文字
- 8 - プロトコル(ipv6、ipv4)
# I selected them both
しかし、1、2、3、5、7回は本当に助けが必要です。テストメールを送信しようとしても何も受信されないからです。
事前にありがとう
修正する:
オペレーティングシステム情報
NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
サフィックスバージョン
mail_version = 3.4.10
ミーティング後
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 100
mydestination = aoos.homenet.telecomitalia.it, aoos, localhost.localdomain, , localhost
myhostname = aoos.homenet.telecomitalia.it
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter =
relayhost =
smtp_tls_CApath = /etc/ssl/certs
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level = may
メールキュー
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
DD866CE073F* 2566 Sun May 10 18:17:10 MAILER-DAEMON
broxigar@aoos
DA34ECE0693* 2493 Fri May 15 19:08:58 MAILER-DAEMON
broxigar@aoos
D474DCE0692* 2531 Fri May 15 19:08:58 MAILER-DAEMON
broxigar@aoos
CFCC4CE0690* 2491 Fri May 15 19:08:58 MAILER-DAEMON
broxigar@aoos
0DC1FCE0738* 2398 Sun May 10 18:05:51 MAILER-DAEMON
broxigar@aoos
D06F9CE0691* 2497 Fri May 15 19:08:58 MAILER-DAEMON
broxigar@aoos
3534ECE068E 417 Fri May 15 17:01:06 broxigar@aoos
(host mx.<domain_name>.it[130.192.182.65] said: 452 4.5.2 Could not resolve sender domain. (in reply to MAIL FROM command))
userXXX@<domain_name>.it
編集後(postconf -n)
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
readme_directory = no
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2
# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtp_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_tls_wrappermode = yes
smtp_tls_security_level = encrypt
#smtp_tls_CApath=/etc/ssl/certs
#smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
#smtp_sasl_auth_enable = yes
#smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
#smtp_sasl_security_options = noanonymous
#smtp_tls_security_level = encrypt
#smtp_tls_wrappermode = yes
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = aoos.polito.it
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = $myhostname, aoos.polito.it, localhost.polito.it, localhost
#myorigin = $mydomain
relayhost = [mail.polito.it]:465
#relay_domains = $mydestination
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
編集後(mailq)
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
64428CE10EA* 2334 Fri Jun 19 22:55:27 MAILER-DAEMON
broxigar@aoos
編集後(journalctl -xe)
Jun 19 22:55:29 aoos postfix/smtp[1158006]: 64428CE10EA: to=<broxigar@aoos>, relay=server.domain.it[<ip_addr>]:465, delay=2, delays=0.01/0/0.03/2, dsn=5.0.0, status=bounced (host server.domain.it[<ip_addr>] said: 551 broxigar@aoos failed to route the address (in reply to RCPT TO command))
答え1
[免責事項:以下はPostfix v3.5.1で完全にテストされています。最新のArch Linuxのインストール時。 Ubuntu 20.04でPostfix v3.4.10のトラブルシューティングmain.cf
と/またはmaster.cf
。 ]
で始まるパラメータ設定が表示されますsmtpd_...
。これは、ホストのローカルサフィックス設定が処理できる場合にのみ必要です。着信メール。欲しいなら送るsmtpリレーを介して電子メールを送信すると、コメントすることができます。
エラー452: 送信者ドメインを確認できません。 (MAIL FROM コマンドに応答) userXXX@\< domain_name
>.it
ローカルホストのドメイン名が正しく解決されません。明らかに、質問の編集のために正しく設定されていません。以下を追加するか、既存の設定を変更します/etc/postfix/main.cf
。
append_at_myorigin = yes
append_dot_mydomain = ${{$compatibility_level} < {1} ? {yes} : {no}}
tls_append_default_CA = no
inet_interfaces = $myhostname, localhost
# might speed up your sending process if your host
# is part of a subnet with other hosts.
mydestination = $myhostname, localhost.$mydomain, localhost
mydomain = aoos # confirm that's the local domain name you chose
myhostname = localhost
mynetworks_style = subnet
myorigin = $mydomain
relay_domains = $mydestination
relayhost = [smtp.gmail.com]:465 # << only when using gmail as smtp server.
# Replace with your own smtp server. Always include
# square brackets as shown + optional port.
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
# or use 'smtp_tls_CApath = /etc/ssl/certs' as shown by you
smtp_tls_security_level = encrypt # Use either 'encrypt' or 'may'
smtp_tls_wrappermode = yes # Poorly or not documented, but necessary when
# using TLS with Google's smtp outgoing mail gateway
smtp_use_tls = yes
上記に加えて、使用するsmtpゲートウェイのユーザー名とパスワードも保護する必要があります。/etc/postfix/sasl_passwd
以下ではsmtp.gmail.comの例を示します。
$ cat /etc/postfix/sasl_passwd
[smtp.gmail.com]:465 <my_username>@gmail.com:<my_passwd>
$ sudo chmod 600 /etc/postfix/sasl_passwd
$ sudo postmap /etc/postfix/sasl_passwd
編集#1:次のようにすることもできます。$ sudo chown root:postfix /etc/postfix/sasl_passwd*
postfix
サービスを有効にして開始したとします。有効になっていない場合は、次の操作を行いますsudo systemctl enable postfix
。
構成パラメーターを再ロードしてpostfix
サービスを再始動します。
$ sudo postfix reload
$ sudo systemctl restart postfix.service
最後にメールを送ってください。
$ touch foobar
$ mail -s "test #<my_test_nbr>" -a foobar <my_external_email> < <(echo "Hello world")
$ journalctl -xe # report relevant warnings & errors (***EDIT***)
$ mailq # report full output
もっとご質問がございましたらお届けください。 HTH。
編集#2:
postfixを使用してメールを送信しようとしたところ、IPv6経由で送信されることがわかりました。 RFC-6724は、コンピュータがデュアルスタック(IPv4プロトコルとIPv6プロトコルが同じネットワークインフラストラクチャで実行されている場合)の場合は、まずIPv6に接続しようとすることを示します。おそらくそのような設定があるでしょう。 AFAIK、Google は IPv6 経由の stmp 要求を受け付けますが、要求元が提供する場合にのみ許可されます。認証に使用されるリバースドメイン名目的。これはMTA側では制御できず、ISPの手にあります。したがって、私があなたの場合は、まずIPv4を介して転送しようとし、次にIPv6を試してみましょう。これを行うには、少なくともGmailでテストするには、/etc/postfix/main.cf
次のように変更してください。
inet_protocols = ipv4
これは、すべてのIP接続がIPv4を使用する必要があるわけではありません。それでもIPv6(Gmailを除く)が必要な場合は、postfix
マップを使用してこの問題を解決できます。transport
他の投稿で別の質問をしたい場合があります。