CentOS7でメールを送信するスクリプトを作成し試しているのですが、
受信先のメールに一行に届く気配がありません。
スクリプトは正常に終了しているように見えます。
DNSサーバで何か「root@localhost」というドメインを探して失敗しているのかなと思っているのですが、
あまりネットワーク系の知識がないため、どこのファイルを修正すべきかわからず困っております。
ご存知の方いらっしゃいましたら、よろしくお願いいたします。
SellScript
1#! /bin/sh 2{ 3 echo "From: test@gmail.com" /実際のアドレスは違うものです 4 echo "To: test@testtest.com" /実際のアドレスは違うものです 5 echo "Subject: this is test" 6 echo 7 echo this is test. 8} | sendmail -i -t
resultlog1
1【/var/spool/mail/root】 2 3Arrival-Date: Sun, 30 Jan 2022 21:47:56 +0900 4 5Final-Recipient: RFC822; test@testtest.com 6X-Actual-Recipient: rfc822; test@testtest.com 7Action: failed 8Status: 5.5.2 9Diagnostic-Code: SMTP; 501 5.5.3 Invalid Address 10Last-Attempt-Date: Sun, 30 Jan 2022 21:47:56 +0900 11 12--20UCluKb048176.1643546876/test.gmail.com 13Content-Type: message/rfc822 14 15Return-Path: <root@118-27-107-171> 16Received: from 118-27-107-171 (localhost [127.0.0.1]) 17 by test.gmail.com (8.16.1/8.16.1) with ESMTPS id 20UCltKc048174 18 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) 19 for <test@testtest.com>; Sun, 30 Jan 2022 21:47:56 +0900 20Received: (from root@localhost) 21 by 118-27-107-171 (8.16.1/8.16.1/Submit) id 20UCltrs048173; 22 Sun, 30 Jan 2022 21:47:55 +0900 23Date: Sun, 30 Jan 2022 21:47:55 +0900 24Message-Id: <202201301247.20UCltrs048173@118-27-107-171> 25From: test@gmail.com 26To: test@testtest.com 27Subject: this is test 28 29this is test. 30 31--20UCluKb048176.1643546876/test.gmail.com-- 32 33 34--20UCluKc048176.1643546876/test.gmail.com-- 35
resultlog2
1 2/var/log/maillog 3 4Jan 30 21:46:55 localhost sendmail[48173]: My unqualified host name (XXX-XX-XXX-XXX) unknown; sleeping for retry 5Jan 30 21:47:55 localhost sendmail[48173]: unable to qualify my own domain name (XXX-XX-XXX-XXX) -- using short name 6Jan 30 21:47:55 localhost sendmail[48173]: 20UCltrs048173: from=root, size=89, class=0, nrcpts=1, msgid=<202201301247.20UCltrs048173@XXX-XX-XXX-XXX>, relay=root@localhost 7Jan 30 21:47:55 localhost sendmail[48173]: STARTTLS=client, relay=[127.0.0.1], version=TLSv1.3, verify=FAIL, cipher=TLS_AES_256_GCM_SHA384, bits=256/256 8Jan 30 21:47:56 localhost sendmail[48174]: STARTTLS=server, relay=localhost [127.0.0.1], version=TLSv1.3, verify=NOT, cipher=TLS_AES_256_GCM_SHA384, bits=256/256 9Jan 30 21:47:56 localhost sendmail[48174]: 20UCltKc048174: from=<root@XXX-XX-XXX-XXX>, size=310, class=0, nrcpts=1, msgid=<202201301247.20UCltrs048173@XXX-XX-XXX-XXX>, proto=ESMTPS, daemon=MTA, relay=localhost [127.0.0.1] 10Jan 30 21:47:56 localhost sendmail[48173]: 20UCltrs048173: to=test@testtest.com, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30089, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (20UCltKc048174 Message accepted for delivery) 11Jan 30 21:47:56 localhost sendmail[48176]: 20UCltKc048174: to=<test@testtest.com>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=120310, relay=yyyyy.zzzzz.ne.jp. [xxx.x.xxx.xxx], dsn=5.6.0, reply=501 5.5.3 Invalid Address, stat=Data format error 12Jan 30 21:47:56 localhost sendmail[48176]: 20UCltKc048174: 20UCluKb048176: DSN: Data format error 13Jan 30 21:47:56 localhost sendmail[48176]: 20UCluKb048176: to=<root@XXX-XX-XXX-XXX>, delay=00:00:00, xdelay=00:00:00, mailer=esmtp, pri=31596, relay=XXX-XX-XXX-XXX, dsn=5.1.2, stat=Host unknown (Name server: XXX-XX-XXX-XXX: host not found) 14Jan 30 21:47:56 localhost sendmail[48176]: 20UCluKb048176: 20UCluKc048176: return to sender: Host unknown (Name server: XXX-XX-XXX-XXX: host not found) 15Jan 30 21:47:56 localhost sendmail[48176]: 20UCluKc048176: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=32620, dsn=2.0.0, stat=Sent
ログに、
Jan 30 21:46:55 localhost sendmail[48173]: My unqualified host name (XXX-XX-XXX-XXX) unknown; sleeping for retry
とあって、これは送信元の hostname が FQDN の形式になっていないのでメールは送信しませんよ、という意味です。/etc/hosts に alias を追加するか、もしくは sendmail.cf での設定で回避できるかもしれません。(XXX-XX-XXX-XXX の部分がメールの Received: で見えちゃってますけど)
回答1件
あなたの回答
tips
プレビュー