[Ubuntu 14.04 LAMP] Installed sendmail -- fatal error when I sent first message

OS: Ubuntu 14.04 Stack: LAMP


I followed Jonathan’s instructions from from this post.

I created a test email and saved it at /tmp/email.txt

I tried to send a test email from a text file to my Yahoo email account using this command:

sendmail  < /tmp/email.txt

The process completed.

When I logged back in, it said I had mail.

I installed mailutils to read the mail. It was a returned message saying sendmail couldn’t send the message and it mentioned a fatal error.

Here is the complete message:

From MAILER-DAEMON  Fri Nov 13 11:22:34 2015
Return-Path: <MAILER-DAEMON>
Received: from localhost (localhost)
	by roypenroddotcom (8.14.4/8.14.4/Debian-4.1ubuntu1) id tADGMYu6005485;
	Fri, 13 Nov 2015 11:22:34 -0500
Date: Fri, 13 Nov 2015 11:22:34 -0500
From: Mail Delivery Subsystem <MAILER-DAEMON>
Message-Id: <201511131622.tADGMYu6005485@roypenroddotcom>
To: <roy@roypenroddotcom>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message


The original message was received at Fri, 13 Nov 2015 11:22:33 -0500
from localhost []

   ----- The following addresses had permanent fatal errors -----
    (reason: 501 Syntax error in parameters or arguments)

   ----- Transcript of session follows -----
... while talking to
>>> MAIL From:<roy@roypenroddotcom> SIZE=637
<<< 501 Syntax error in parameters or arguments
501 5.6.0 Data format error

Content-Type: message/delivery-status

Reporting-MTA: dns; roypenroddotcom
Received-From-MTA: DNS; localhost
Arrival-Date: Fri, 13 Nov 2015 11:22:33 -0500

Final-Recipient: RFC822;
Action: failed
Status: 5.5.2
Diagnostic-Code: SMTP; 501 Syntax error in parameters or arguments
Last-Attempt-Date: Fri, 13 Nov 2015 11:22:34 -0500

Content-Type: text/rfc822-headers

Return-Path: <roy@roypenroddotcom>
Received: from roypenroddotcom (localhost [])
	by roypenroddotcom (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id tADGMXu6005483
	for <>; Fri, 13 Nov 2015 11:22:33 -0500
Received: (from roy@localhost)
	by roypenroddotcom (8.14.4/8.14.4/Submit) id tADGMXlU005480
	for; Fri, 13 Nov 2015 11:22:33 -0500
Date: Fri, 13 Nov 2015 11:22:33 -0500
From: Roy Penrod <roy@roypenroddotcom>
Message-Id: <201511131622.tADGMXlU005480@roypenroddotcom>
Subject: Terminal Email Send


Problem 1:
I noticed the return-path is roy@roypenroddotcom. I named my host roypenroddotcom because it’s hosting my own personal site,

I’m very new to Linux, so I didn’t know the hostname would affect this. How do I change it so my email address is actually

Problem 2:
Why did the sendmail fail? Was it the incorrect email address? Did I set something up wrong? Do I need to configure sendmail?

Any help you can give me is very much appreciated.


Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I just setup my domain with mail server a few days ago, I’ll share another pointer:

my 2 cents (may be over valued):

After installing the software already mentioned here, I had to change the name of my droplet (from the digital ocean web control panel) to my full domain name, in your case, I was just using a nickname with no TLD when I originally set it up.

This allows the reverse dns lookup of your ip address (PTR record) to properly show your domain name. If your IP does not properly reverse DNS to your domain name, most of your e-mail will be marked as spam.

So after I did that and set my hostname, configured, added the iptables firewall rule, etc… I sent out a few test emails to my other email accounts. A GoDaddy account and a Hotmail account. I never received them, so I checked my sendmail log and the mail servers (Hotmail and GoDaddy) said my ip address had been black listed for spam. Maybe a previous owner, I’m not sure, because I haven’t sent any mail at all from this ip address since I’ve had it (< 2 weeks).

So I had to contact (sender information form to ask to be removed from the spam list. Same with GoDaddy, but it was a different contact website.

After a couple of days my e-mails started going through and working, but I’m not sure how many other blacklists my IP is on, so running an email service from my server may not be very reliable.

Summary: I can receive e-mails no problem to my domain, but if I’m sending an email to an address I’ve never e-mailed before, there is no guarantee it will go through. If I wanted to setup a reliable email service, perhaps or something similar.


Found one of them :-).

It’s been a little while since I’ve used this one, though it’s complete, has a web GUI, and will handle a ton of the technical aspects of the setup associated with allowing your web server to handle incoming and outgoing mail.

I would download the source from the link above to your local computer first, read over the docs, and deploy a 1GB Droplet for a few hours. This will allow you to tinker with the script without any changes to your current droplet (if it’s hosting content).

If you have an extra domain that’s not in use, you could set the DNS for that domain to the new Droplet, which would allow you to test mail setting once everything is setup.

From there, installing Apache/NGINX/Caddy, PHP and other software on top would be all that needs to be done.

I will say, however, that if you plan on running a mail server, web server and database server all from a single Droplet, I would advise a 1GB minimum, 2GB preferred for optimal performance and room as the software that runs in the background can be a little demanding at times.


For completeness, I would setup your DNS as I outlined in our previous discussion, though first, I would login as root and run the following:


This will tell you what your servers hostname is set as right now (which should match roypenroddotcom if that’s what you named it when deploying the Droplet).

Now think of a short name for your server. It could be something like web01, core01, node01, droplet01 etc (it doesn’t have to contain a number, web works too). This will be your “new” server name and to it, you’ll append your domain name like so (I’ll use web in this example):

Now run:


This will change your hostname from roypenroddotcom to At this point, we need to make sure the DNS can validate this hostname, so we have two primary options.

  • Create a WildCard DNS Entry
  • Create an A Entry Exclusively for

The DNS entries would look like:



Exclusive A Entry


My personal preference is WildCard since it takes care of pretty much everything for you, reduces the # of 404 errors in the long run (since it forces everything to resolve to your hostname or domain).

When I said it didn’t matter which step you took first, I failed to dive deeper in to DNS and for that I apologize. While what I said is indeed true, making sure your DNS is correct is very important. When it comes to e-mail, basically all DNS needs to resolve. If the receiving servers are unable to resolve your domain, the server or other areas of your DNS, they’ll reject it or worse, mark it as SPAM or blacklist (thus none of your e-mail will go through).

That being said, from the previous conversation, I was under the impression you were simply looking to use PHP’s mail() function to send mail through PHP, not for handling actual e-mail address creation, local delivery etc.

When it comes to setting up an e-mail server, such as one that will allow you to create multiple e-mail accounts using your domain, or any number of domains you choose to host on the server, things are a little more in-depth and complicated. In such a case, using sendmail is not really the best option. I’d be more apt to recommend using postfix, dovecot, claimav and spamassassin to manage this more efficiently.

The setup for all four isn’t quick by any means, though there are a few alternative options to speed up that process. I know that there was a post, IIRC, here in the community that highlighted a shell script that would automatically handle setting all of this up for you.

If you’re wanting to physically host e-mail accounts, I’ll see if I can dig up that link. Many of the tutorials around the web (i.e. Google results) are outdated, missing steps etc - so I don’t put much faith in them. I do know, however, that if I can find the link, this script does work and it will keep you from pulling your hair out :-).