Hi [2024-12-10 07:29] Hagen Bauer <hagen.ba...@caserio.de> > I am using mstmp to send administrative mails from my server. To my suprise I > saw that my mails are not accepted from my mail server > . I can not recall any changes that could have led to this > nor a timeframe since when. I used this commandline for a long time. > > I am using OpenSMTPD 7.3.0-portable. > > I dont get it that a leading space is a difference.
It's because msmtp takes mails on stdin not the mail body. With the space you make your input as part of the autogenerated header field. > Tis is a mail that is acceppted > > ``` > echo ' Hello this is sending email using msmtp' | msmtp > hagen.ba...@caserio.de -vv > > <-- 250-falcon.sesameh.de Hello sesameh.de [xxx.xxx.xxx.xxx], pleased to meet > you > <-- 250-8BITMIME > <-- 250-ENHANCEDSTATUSCODES > <-- 250-SIZE 36700160 > <-- 250-DSN > <-- 250 HELP > --> MAIL FROM:<ser...@sesameh.de> > <-- 250 2.0.0 Ok > --> RCPT TO:<hagen.ba...@caserio.de> > <-- 250 2.1.5 Destination address valid: Recipient ok > --> DATA > <-- 354 Enter mail, end with "." on a line by itself > --> From: ser...@sesameh.de > --> Date: Tue, 10 Dec 2024 06:38:18 +0100 > --> Message-ID: <fcf6d09d3fdb00bd2ea04203c966e...@sesameh.de> > --> Hello this is sending email using msmtp > --> . Here you see a mail only contains a header. This header contains three fields. The Message-ID field contains your text. You should have notice this, because your MUA wouldn't show your content. > <-- 250 2.0.0 5c37e7a9 Message accepted for delivery > --> QUIT > <-- 221 2.0.0 Bye > > ``` > and this mail is not accepted > > ``` > > > > > and this mail is not accepted > > ``` > > echo 'Hello this is sending email using msmtp' | msmtp hagen.ba...@caserio.de > -vv > > 1 <-- 250-falcon.sesameh.de Hello sesameh.de [xxx.xxx.xxx.xxx], pleased to > meet you > 2 <-- 250-8BITMIME > 3 <-- 250-ENHANCEDSTATUSCODES > 4 <-- 250-SIZE 36700160 > 5 <-- 250-DSN > 6 <-- 250 HELP > 7 --> MAIL FROM:<ser...@sesameh.de> > 8 <-- 250 2.0.0 Ok > 9 --> RCPT TO:<hagen.ba...@caserio.de> > 10 <-- 250 2.1.5 Destination address valid: Recipient ok > 11 --> DATA > 12 <-- 354 Enter mail, end with "." on a line by itself > 13 --> From: ser...@sesameh.de > 14 --> Date: Tue, 10 Dec 2024 06:30:40 +0100 > 15 --> Message-ID: <511c4459db751cffa69d0b0744fd6...@sesameh.de> > 16 --> Hello this is sending email using msmtp When a line in the mail header doesn't start with a whitespace the next field is started. So "Hello this is sending email using msmtp" is parsed as a field. This fails because it doesn't contain a colom. > 17 --> . > 18 <-- 550 5.7.1 Delivery not authorized, message refused: Message is not > RFC 2822 compliant > 19 msmtp: the server did not accept the mail > 20 msmtp: server message: 550 5.7.1 Delivery not authorized, message > refused: Message is not RFC 2822 compliant > > ``` To fixed this use: printf "\nHello this is sending email using msmtp\n" |msmtp Philipp