Sendmail error – cannot mail directly to files

Major Productions asked:

As a continuation of this question, I did some more research and found this answer on SuperUser which seems to have solved my issue with sendmail being unable to write a particular file. Specifically, stopping sendmail, checking for ongoing processes, killing them, and then restarting sendmail fixed that portion of my problem.

As a test, I attempted to send another email to myself from the command line: echo "Subject: sendmail test" | sudo sendmail /usr/sbin/sendmail -v [email protected]. The email did not send correctly, but I did get a bounced email from sendmail itself with the error(s):

From MAILER-DAEMON  Tue Jul 23 12:44:30 2019
Return-Path: <MAILER-DAEMON>
Received: from major-productions.com (localhost [127.0.0.1])
        by major-productions.com (8.15.2/8.15.2/Debian-12) with ESMTP id x6NGiUQO012820
        for <[email protected]>; Tue, 23 Jul 2019 12:44:30 -0400
Received: from localhost (localhost)
        by major-productions.com (8.15.2/8.15.2/Submit) id x6NGiUSL012819;
        Tue, 23 Jul 2019 12:44:30 -0400
Date: Tue, 23 Jul 2019 12:44:30 -0400
From: Mail Delivery Subsystem <[email protected]>
Message-Id: <[email protected]>
To: [email protected]
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
        boundary="x6NGiUSL012819.1563900270/major-productions.com"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message

--x6NGiUSL012819.1563900270/major-productions.com

The original message was received at Tue, 23 Jul 2019 12:44:30 -0400
from [email protected]

----- The following addresses had permanent fatal errors -----
/usr/sbin/sendmail
    (reason: 550 5.7.1 </usr/sbin/[email protected]>... Cannot mail directly to files)
    (expanded from: /usr/sbin/sendmail)
-v
    (reason: 550 5.1.1 <[email protected]>... User unknown)
    (expanded from: -v)

   ----- Transcript of session follows -----
... while talking to [127.0.0.1]:
>>> DATA
<<< 550 5.1.1 <[email protected]>... User unknown
550 5.1.1 -v... User unknown
<<< 550 5.7.1 </usr/sbin/[email protected]>... Cannot mail directly to files
550 5.1.1 /usr/sbin/sendmail... User unknown

--x6NGiUSL012819.1563900270/major-productions.com
Content-Type: message/delivery-status

Reporting-MTA: dns; major-productions.com
Arrival-Date: Tue, 23 Jul 2019 12:44:30 -0400

Final-Recipient: RFC822; /usr/sbin/[email protected]
Action: failed
Status: 5.7.1
Remote-MTA: DNS; [127.0.0.1]
Diagnostic-Code: SMTP; 550 5.7.1 </usr/sbin/[email protected]>... Cannot mail directly to files
Last-Attempt-Date: Tue, 23 Jul 2019 12:44:30 -0400

Final-Recipient: RFC822; [email protected]
Action: failed
Status: 5.1.1
Remote-MTA: DNS; [127.0.0.1]
Diagnostic-Code: SMTP; 550 5.1.1 <[email protected]>... User unknown
Last-Attempt-Date: Tue, 23 Jul 2019 12:44:30 -0400

--x6NGiUSL012819.1563900270/major-productions.com
Content-Type: message/rfc822

Return-Path: <me>
Received: (from [email protected])
        by major-productions.com (8.15.2/8.15.2/Submit) id x6NGiUSK012819;
        Tue, 23 Jul 2019 12:44:30 -0400
Date: Tue, 23 Jul 2019 12:44:30 -0400
From: Dude Guy <me>
Message-Id: <[email protected]>
Subject: sendmail test

--x6NGiUSL012819.1563900270/major-productions.com--

I’m guessing it’s a config error, but have no idea where to look/what to change.

My answer:


You called sendmail, but told it that you wanted to deliver mail to /usr/sbin/sendmail, then -v, and then [email protected]. Only the last email seems to have gone through; the other two obviously bounced.

It’s not clear why you wrote the command line that way, but I guess it’s just a mistake. You should have written sendmail -v [email protected] or something similar.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.