Pipe date output in mail for testing; it may differ from date mail was sent:
Code:date | mail -s test root
date | mail -s test -r karl....@.... karl....@....
Printable View
The script has to setup everything in the code. I have many different auto-setup sections for many items. If postfix is needed to use mailx, I need to make a cross linux distros auto-setup.Code:# zypper if postfix
Loading repository data...
Reading installed packages...
Information for package postfix:
--------------------------------
Repository : Update repository with updates from SUSE Linux Enterprise 15
Name : postfix
Version : 3.5.9-5.9.2
Arch : x86_64
Vendor : SUSE LLC <https://www.suse.com/>
Installed Size : 3.2 MiB
Installed : Yes (automatically)
Status : up-to-date
Source package : postfix-3.5.9-5.9.2.src
Summary : A fast, secure, and flexible mailer
Description :
Postfix aims to be an alternative to the widely-used sendmail program.
PS, the code is setup to send webmail not local mail. It will be another option I will add later, last one. Based on the above, I should be able to mail to local user with an attachment, for sending to admins.Code:
No mail for root
localhost:~ # date | mail -s test root
localhost:~ # mail
Heirloom mailx version 12.5 7/5/10. Type ? for help.
"/var/spool/mail/root": 1 message 1 new
>N 1 root@localhost Mon Jan 24 22:14 18/539 test
? 1
Message 1:
From root@localhost Mon Jan 24 22:14:41 2022
X-Original-To: root
Delivered-To: root@localhost
Date: Mon, 24 Jan 2022 22:14:41 -0800
To: root@localhost
Subject: test
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: root <root@localhost>
Mon Jan 24 22:14:41 PST 2022
? d
? 1
1: Inappropriate message
? quit
format line:
scanvirus -sv f 1 home/username
scanvirus -sv m 1 username@server.com
scanvirus -sv e 1 root
('-sv l' is list users).
https://www.tutorialspoint.com/unix_commands/mail.htm
No error output and no emails, 5 checks over 5 mins. ?? No debug info.Code:
No mail for root
localhost:~ # date | mail -s test -r username@server.com username@server.com
localhost:~ # mail
No mail for root
localhost:~ # date | mail -v -s test -r username@server.com username@server.com
Mail Delivery Status Report will be mailed to <username@server.com>.
Web search 'linux command line mail log', nothing useful.
I never tinkered with mail. Command works here with default installation setup:
Code:Return-Path: <root@localhost>
X-Original-To: root
Delivered-To: root@localhost
Received: by localhost (Postfix, from userid 0)
id DDABE560E0; Tue, 25 Jan 2022 08:52:52 +0100 (CET)
Date: Tue, 25 Jan 2022 08:52:52 +0100
To: root@localhost
Subject: test
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20220125075252.DDABE560E0@localhost>
From: root <root@localhost>
Tue Jan 25 08:52:52 CET 2022
Code:erlangen:~ # journalctl -b -u postfix.service --since 08:40
Jan 25 08:52:52 erlangen postfix/pickup[2901]: DDABE560E0: uid=0 from=<root>
Jan 25 08:52:52 erlangen postfix/cleanup[6413]: DDABE560E0: message-id=<20220125075252.DDABE560E0@localhost>
Jan 25 08:52:52 erlangen postfix/qmgr[1046]: DDABE560E0: from=<root@localhost>, size=426, nrcpt=1 (queue active)
Jan 25 08:52:52 erlangen postfix/local[6415]: DDABE560E0: to=<karl@localhost>, orig_to=<root>, relay=local, delay=0.04, delays=0.01/0.02/0/0, dsn=2.0.0, status=sent (delivered to maildir)
Jan 25 08:52:52 erlangen postfix/qmgr[1046]: DDABE560E0: removed
erlangen:~ #
The delivery status email wasn't going through. So, I changed the line to this.
Code:cat /var/log/VirusVault/VirusFoundZipSendEmailBody.cfg | mail -v -r root -s "$VirusFoundZipSendEmailSubject" "$Zip_Send_Email"
I had that email active and ready to receive. I sent an email to my old yahoo account same results.Code:Message 1:
From MAILER-DAEMON Tue Jan 25 16:18:49 2022
X-Original-To: root@localhost
Delivered-To: root@localhost
Date: Tue, 25 Jan 2022 16:18:49 -0800 (PST)
From: MAILER-DAEMON@localhost (Mail Delivery System)
Subject: Mail Delivery Status Report
To: root@localhost
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="E73A444306.1643156329/localhost"
Content-Transfer-Encoding: 8bit
Part 1:
Content-Description: Notification
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
This is the mail system at host localhost.
Enclosed is the mail delivery report that you requested.
The mail system
<username@server.com>: connect to
mailsec.protonmail.ch[176.119.200.129]:25: Connection timed out
?? No clue why...
Full addresses required: "-r localpart@domain". Web servers check for existence.
Encryption required:
See also /etc/postfix/sasl_passwdCode:erlangen:~ # postconf smtp_use_tls
smtp_use_tls = yes
erlangen:~ # postconf smtp_enforce_tls
smtp_enforce_tls = yes
erlangen:~ #
Roundtrip mailx > postfix > Provider > fetchmail > postfix:
Code:From MAILER-DAEMON@localhost Tue Jan 25 08:12:27 2022
Return-Path: <>
X-Original-To: karl@localhost
Delivered-To: karl@localhost
Received: from erlangen.fritz.box (localhost [IPv6:::1])
by localhost (Postfix) with ESMTP id C9AF35668B
for <karl@localhost>; Tue, 25 Jan 2022 09:13:10 +0100 (CET)
Delivered-To: m10000*****
Received: from imap.mnet-online.de [2001:a60::143:1]
by erlangen.fritz.box with IMAP (fetchmail-6.4.26)
for <karl@localhost> (single-drop); Tue, 25 Jan 2022 09:13:10 +0100 (CET)
Received: from frontend02 ([127.0.0.1])
by backend02-a.mail.m-online.net with LMTP id 8GOpG+2w72G+dwAAyMk8yg
for <m1000075757>; Tue, 25 Jan 2022 09:12:29 +0100
Received: from mail.m-online.net ([127.0.0.1])
by frontend02 with LMTP id WPjLGu2w72GaTQAAz6fncw
; Tue, 25 Jan 2022 09:12:29 +0100
Received: from scanner-3.m-online.net (unknown [192.168.6.82])
by mail.m-online.net (Postfix) with ESMTP id 4Jjfj92RBvz1qqkC
for <karl@somewhere>; Tue, 25 Jan 2022 09:12:29 +0100 (CET)
X-Virus-Scanned: by amavisd-new at mnet-online.de
Received: from mxin-1.m-online.net ([192.168.6.165])
by scanner-3.m-online.net (scanner-3.mail.m-online.net [192.168.6.82]) (amavisd-new, port 10026)
with ESMTP id 8AWMg8kRIWv8 for <karl@somewhere>;
Tue, 25 Jan 2022 09:12:28 +0100 (CET)
Received: from bounces.m-online.net (bounces.m-online.net [212.114.242.6])
by mxin-1.m-online.net (Postfix) with ESMTP id 4Jjfj84hzLzvPsX
for <karl@somewhere>; Tue, 25 Jan 2022 09:12:28 +0100 (CET)
Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
by bounces.m-online.net (Postfix) with ESMTP id 4Jjfj84RmSz1qqkg
for <karl@somewhere>; Tue, 25 Jan 2022 09:12:28 +0100 (CET)
Received: from localhost (dynscan1.mnet-online.de [192.168.6.70])
by mail.m-online.net (Postfix) with ESMTP id 4Jjfj84DJpz1qqkH
for <karl@somewhere>; Tue, 25 Jan 2022 09:12:28 +0100 (CET)
Received: from mail.mnet-online.de ([192.168.8.182])
by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024)
with ESMTP id S2I_cq5evPKS for <karl@somewhere>;
Tue, 25 Jan 2022 09:12:27 +0100 (CET)
X-Auth-Info: Ty7VZyozO7aGLLfmDarsqMsEW3I/7XBFcZdqvORXlnsDNibDWDuGNHCugWHpQtNw
Received: from localhost (aftr-185-17-204-185.dynamic.mnet-online.de [185.17.204.185])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mail.mnet-online.de (Postfix) with ESMTPSA
for <karl@somewhere>; Tue, 25 Jan 2022 09:12:27 +0100 (CET)
Received: by localhost (Postfix)
id 8C42156689; Tue, 25 Jan 2022 09:12:27 +0100 (CET)
Date: Tue, 25 Jan 2022 09:12:27 +0100 (CET)
From: MAILER-DAEMON@localhost (Mail Delivery System)
Subject: Mail Delivery Status Report
To: karl@somewhere
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="A30AD56687.1643098347/localhost"
Content-Transfer-Encoding: 8bit
Message-Id: <20220125081227.8C42156689@localhost>
This is a MIME-encapsulated message.
--A30AD56687.1643098347/localhost
Content-Description: Notification
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
This is the mail system at host localhost.
Enclosed is the mail delivery report that you requested.
The mail system
<karl@somewhere>: delivery via
mail.mnet-online.de[62.245.150.229]:25: 250 2.0.0 from
MTA(smtp:[frontend01.mail.intern.m-online.net]:10025): 250 2.0.0 Ok: queued
as 4Jjfj73pWkz1qqkB
--A30AD56687.1643098347/localhost
Content-Description: Delivery report
Content-Type: message/delivery-status
Reporting-MTA: dns; localhost
X-Postfix-Queue-ID: A30AD56687
X-Postfix-Sender: rfc822; karl@somewhere
Arrival-Date: Tue, 25 Jan 2022 09:12:26 +0100 (CET)
Final-Recipient: rfc822; karl@somewhere
Original-Recipient: rfc822;karl@somewhere
Action: relayed
Status: 2.0.0
Remote-MTA: dns; mail.mnet-online.de
Diagnostic-Code: smtp; 250 2.0.0 from
MTA(smtp:[frontend01.mail.intern.m-online.net]:10025): 250 2.0.0 Ok: queued
as 4Jjfj73pWkz1qqkB
--A30AD56687.1643098347/localhost
Content-Description: Message Headers
Content-Type: text/rfc822-headers
Content-Transfer-Encoding: 8bit
Return-Path: <karl@somewhere>
Received: by localhost (Postfix, from userid 1000)
id A30AD56687; Tue, 25 Jan 2022 09:12:26 +0100 (CET)
Date: Tue, 25 Jan 2022 09:12:26 +0100
From: karl@somewhere
To: karl@somewhere
Subject: test
Message-ID: <61efb0ea.VpscK30h6hkEFfit%karl@somewhere>
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
--A30AD56687.1643098347/localhost--
Code:# postconf smtp_use_tls
smtp_use_tls = no
localhost:~/bin # postconf smtp_enforce_tls
smtp_enforce_tls = no
localhost:~/bin #
Code:# postconf smtp_use_tls
smtp_use_tls = yes
# postconf smtp_enforce_tls
smtp_enforce_tls = yes
Nothing.Code:cat /var/log/VirusVault/VirusFoundZipSendEmailBody.cfg | mail v -s "$VirusFoundZipSendEmailSubject" -a "/var/log/VirusVault/VirusFound_${Current_Date}.zip" -r "$Zip_Send_Email" -R "$Zip_Send_Email" "$Zip_Send_Email"
connection timed out.Code:cat /var/log/VirusVault/VirusFoundZipSendEmailBody.cfg | mail -v -s "$VirusFoundZipSendEmailSubject" -a "/var/log/VirusVault/VirusFound_${Current_Date}.zip" -R "$Zip_Send_Email" -R "$Zip_Send_Email" "$Zip_Send_Email"
Watch the journal. Command "date | mail -s test -r fabian.maier@amberg-mail.de fabian.maier@amberg-mail.de" resulted in:
What are your messages?Code:erlangen:~ # journalctl --since 23:50 -u postfix.service
Jan 28 23:50:06 erlangen postfix/pickup[2746]: A93765B222: uid=1000 from=<fabian.maier@amberg-mail.de>
Jan 28 23:50:06 erlangen postfix/cleanup[4536]: A93765B222: message-id=<61f4731e.GsNQxpzJ6/ztbsQ8%fabian.maier@amberg-mail.de>
Jan 28 23:50:06 erlangen postfix/qmgr[1041]: A93765B222: from=<fabian.maier@amberg-mail.de>, size=466, nrcpt=1 (queue active)
Jan 28 23:50:07 erlangen postfix/smtp[4538]: A93765B222: to=<fabian.maier@amberg-mail.de>, relay=mail.mnet-online.de[62.245.150.229]:25, delay=0.89, delays=0.01/0.02/0.35/0.5, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[frontend01.mail.intern.m-online.net]:10025): 2>
Jan 28 23:50:07 erlangen postfix/qmgr[1041]: A93765B222: removed
Jan 28 23:50:56 erlangen postfix/smtpd[4620]: connect from localhost[::1]
Jan 28 23:50:56 erlangen postfix/smtpd[4620]: C8D4A5B223: client=localhost[::1]
Jan 28 23:50:56 erlangen postfix/cleanup[4536]: C8D4A5B223: message-id=<61f4731e.GsNQxpzJ6/ztbsQ8%fabian.maier@amberg-mail.de>
Jan 28 23:50:56 erlangen postfix/qmgr[1041]: C8D4A5B223: from=<fabian.maier@amberg-mail.de>, size=2937, nrcpt=1 (queue active)
Jan 28 23:50:56 erlangen postfix/local[4622]: C8D4A5B223: to=<karl@localhost>, relay=local, delay=0.05, delays=0.03/0.02/0/0, dsn=2.0.0, status=sent (delivered to maildir)
Jan 28 23:50:56 erlangen postfix/qmgr[1041]: C8D4A5B223: removed
Jan 28 23:50:56 erlangen postfix/smtpd[4620]: disconnect from localhost[::1] ehlo=1 mail=1 rcpt=1 data=1 quit=1 commands=5
erlangen:~ #
Return-Path: <fabian.maier@amberg-mail.de>
X-Original-To: karl@localhost
Delivered-To: karl@localhost
Received: from erlangen.fritz.box (localhost [IPv6:::1])
by localhost (Postfix) with ESMTP id C8D4A5B223
for <karl@localhost>; Fri, 28 Jan 2022 23:50:56 +0100 (CET)
Delivered-To: m1000075757
Received: from imap.mnet-online.de [2001:a60::143:1]
by erlangen.fritz.box with IMAP (fetchmail-6.4.26)
for <karl@localhost> (single-drop); Fri, 28 Jan 2022 23:50:56 +0100 (CET)
Received: from frontend04 ([127.0.0.1])
by backend02-a.mail.m-online.net with LMTP id eAS0CyBz9GEdcgAAyMk8yg
for <m1000075757>; Fri, 28 Jan 2022 23:50:08 +0100
Received: from mail.m-online.net ([127.0.0.1])
by frontend04 with LMTP id 0JIPCyBz9GHkWQAA1Ru2Dg
; Fri, 28 Jan 2022 23:50:08 +0100
Received: from scanner-5.m-online.net (unknown [192.168.6.86])
by mail.m-online.net (Postfix) with ESMTP id 4Jlt2S1470z1qqkC
for <fabian.maier@amberg-mail.de>; Fri, 28 Jan 2022 23:50:08 +0100 (CET)
X-Virus-Scanned: by amavisd-new at mnet-online.de
Received: from mxin-1.m-online.net ([192.168.6.165])
by scanner-5.m-online.net (scanner-5.mail.m-online.net [192.168.6.86]) (amavisd-new, port 10026)
with ESMTP id 8A9dwx1eLMIM for <fabian.maier@amberg-mail.de>;
Fri, 28 Jan 2022 23:50:07 +0100 (CET)
Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10])
by mxin-1.m-online.net (Postfix) with ESMTPS id 4Jlt2R4PtWzvPsP
for <fabian.maier@amberg-mail.de>; Fri, 28 Jan 2022 23:50:07 +0100 (CET)
Received: from frontend01.mail.m-online.net (unknown [192.168.8.182])
by mail-out.m-online.net (Postfix) with ESMTP id 4Jlt2R3zt8z1sYfG
for <fabian.maier@amberg-mail.de>; Fri, 28 Jan 2022 23:50:07 +0100 (CET)
Received: from localhost (dynscan1.mnet-online.de [192.168.6.70])
by mail.m-online.net (Postfix) with ESMTP id 4Jlt2R3tV7z1qqkB
for <fabian.maier@amberg-mail.de>; Fri, 28 Jan 2022 23:50:07 +0100 (CET)
Received: from mail.mnet-online.de ([192.168.8.182])
by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024)
with ESMTP id IVbJJAfev3u2 for <fabian.maier@amberg-mail.de>;
Fri, 28 Jan 2022 23:50:07 +0100 (CET)
X-Auth-Info: seW5UqTCJJlxmgLl9+Tp/6X9dttWyLE2qLmmg36hX9CQ7kk5Qd1fE7ezEt2ZCeHL
Received: from localhost (aftr-185-17-204-200.dynamic.mnet-online.de [185.17.204.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by mail.mnet-online.de (Postfix) with ESMTPSA
for <fabian.maier@amberg-mail.de>; Fri, 28 Jan 2022 23:50:07 +0100 (CET)
Received: by localhost (Postfix, from userid 1000)
id A93765B222; Fri, 28 Jan 2022 23:50:06 +0100 (CET)
Date: Fri, 28 Jan 2022 23:50:06 +0100
From: fabian.maier@amberg-mail.de
To: fabian.maier@amberg-mail.de
Subject: test
Message-ID: <61f4731e.GsNQxpzJ6/ztbsQ8%fabian.maier@amberg-mail.de>
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Fr 28. Jan 23:50:06 CET 2022
Note: checking forum in a few hours
Scanvirus Output:
Code:cat /var/log/VirusVault/VirusFoundZipSendEmailBody.cfg | mail -v -s "$VirusFoundZipSendEmailSubject" -a "/var/log/VirusVault/VirusFound_${Current_Date}.zip" -R "$Zip_Send_Email" "$Zip_Send_Email"
https://paste.opensuse.org/50a72e99Code:Sending Email...
Mail Delivery Status Report will be mailed to <root>.
?1
Message 1:
From MAILER-DAEMON Fri Jan 28 16:24:17 2022
X-Original-To: root@localhost
Delivered-To: root@localhost
Date: Fri, 28 Jan 2022 16:24:17 -0800 (PST)
From: MAILER-DAEMON@localhost (Mail Delivery System)
Subject: Delayed Mail (still being retried)
To: root@localhost
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="2768646F2D.1643415857/localhost"
Content-Transfer-Encoding: 8bit
Part 1:
Content-Description: Notification
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
This is the mail system at host localhost.
####################################################################
# THIS IS A WARNING ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. #
####################################################################
Your message could not be delivered for more than 1 hour(s).
It will be retried until it is 5 day(s) old.
journal looks quite sane. You may browse https://protonmail.com/support/?s=tls&ht-kb-search=1 or go to https://protonmail.com/support/