On a ubuntu system I have installed postfix and set relayhost and mynetworks in /etc/postfix/main.cf config file.

I can now telnet to port 25 on this server and send an email by issuing the SMTP commands. I ran a test to a gmail account and received the email message ok.

But on the same linux host I installed mail (apt-get mailutils) and ran this command:

mail -s "test email" myname@gmailcom

entered some message text and Ctrl-D and saw no errors but message is never received by recipient.

Do I have to configure the smtp server in mail config somehow? Should I see the messages in some sort of queue waiting to be sent?

Any tips on how to resolve?

Some more info:

my /etc/mailname config file contains the string: mail.mydomain.com and my linux box is not configured with a domain (it is only a test system). Should I change this to just mail? (mail is hostname of box).

I found a mail syntax which allows you to specify the sender which works for me:

mail -s "message 5" -a "From: thingy@mydomain.com" recipient@gmail.com

But I would prefer to fix so I don't need to do that.

Here is the error I see by using mail interactively:

Return-Path: <>
X-Original-To: johnny@mail
Delivered-To: johnny@mail
Received: by mydomain.com (Postfix)
        id BC328647FF; Sun,  6 Jul 2014 18:04:51 +0100 (BST)
Date: Sun,  6 Jul 2014 18:04:51 +0100 (BST)
From: MAILER-DAEMON@mydomain.com (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: johnny@mail
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
Message-Id: <20140706170451.BC328647FF@mydomain.com>

This is a MIME-encapsulated message.

Content-Description: Notification
Content-Type: text/plain; charset=us-ascii

This is the mail system at host mydomain.com.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<thingy@gmail.com>: host post.demon.co.uk[] said: 504 5.5.2
    <johnny@mail>: Sender address rejected: need fully-qualified address (in
    reply to RCPT TO command)

Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; mydomain.com
X-Postfix-Queue-ID: 3EEA5647FE
X-Postfix-Sender: rfc822; johnny@mail
Arrival-Date: Sun,  6 Jul 2014 18:04:46 +0100 (BST)
Final-Recipient: rfc822; thingy@gmail.com
Action: failed
Status: 5.5.2
Remote-MTA: dns; post.demon.co.uk
Diagnostic-Code: smtp; 504 5.5.2 <johnny@mail>: Sender address rejected: need
    fully-qualified address

Content-Description: Undelivered Message
Content-Type: message/rfc822

Return-Path: <johnny@mail>
Received: by mydomain.com (Postfix, from userid 1000)
        id 3EEA5647FE; Sun,  6 Jul 2014 18:04:46 +0100 (BST)
Subject: msg 10
To: <thingy@gmail.com>
X-Mailer: mail (GNU Mailutils 2.99.98)
Message-Id: <20140706170446.3EEA5647FE@mydomain.com>
Date: Sun,  6 Jul 2014 18:04:46 +0100 (BST)
From: johnny@mail (John Hammond)
test message

  • When you did your telnet to port 25 test, what server did you use? did you use localhost? because that is what the mail command will use. – ben Jul 7 '14 at 18:40

To see whether mail is possibly sitting in the queue, use mailq on the command line, or check the content of the /var/spool/mail directory. Postfix should also be logging to /var/log/maillog - you can open another shell session, and tail this file when you run mail in your other shell session - using tail -f /var/log/maillog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.