I can't get emails to work :(

Posted August 4, 2014 4.6k views

Hello i have been trying all day to get emails to work and I am totally lost.

PLEASE PLEASE PLEASE could some one help me.

I have set up a domain which is my own name and i would like to have an email address for that domain like mail@ or info@.

I have set up the domain and that all works.
My droplet is called spangler1 and my login name has changed from root to rickyspires.

This is what i have tried.

I have followed this tutorial

  • First login to the server

  • install postfix
    sudo apt-get update
    sudo apt-get install postfix

  • config the file
    cd /etc/postfix/
    sudo nano

myhostname =
virtualaliasmaps = hash:/etc/postfix/virtual
aliasdatabase = hash:/etc/aliases
mydestination =, spangler1, ricky-spiress-MacBook-Pro.local, localhost
relayhost =
mynetworks =
sizelimit = 0
delimiter = +
inet_interfaces = all

sudo service postfix restart

  • try sending a test email

rickyspires@spangler1:/etc/postfix$ telnet 25
Connected to
Escape character is ’^]’.
220 ESMTP Postfix (Ubuntu)

mail to:

501 5.5.4 Syntax: MAIL FROM:<address>

mail from: (
250 2.1.0 Ok

rcpt to:
550 5.1.1 Recipient address rejected: User unknown in local recipient table

!!!!! I GET AN ERROR HERE - the error wasnt there before ? But even when i didnt get the error at this point the emails would not send.

I get this..... for example

From MAILER-DAEMON Sun Oct 21 07:17:27 2012
X-Original-To: rickyspires@ricky-spiress-MacBook-Pro.local
Delivered-To: rickyspires@ricky-spiress-MacBook-Pro.local
Date: Sun, 21 Oct 2012 07:17:27 +0100 (BST)
From: MAILER-DAEMON@ricky-spiress-MacBook-Pro.local (Mail Delivery System)
Subject: Undelivered Mail Returned to Sender
To: rickyspires@ricky-spiress-MacBook-Pro.local
Auto-Submitted: auto-replied
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
Content-Transfer-Encoding: 8bit


Thanks Ricky

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.

Submit an Answer
2 answers

Hey Ricky,

I think you might not have configured your e-mail users yet (they’re different from your users on your box). Check out this guide

On my droplet I used a different approach: I’m using a third-party provider for e-mail.

I found managing an e-mail server a bit of a hassle so I just use Gmail SMTP for sending e-mail from my box. Unfortunately Google Apps for business are no longer free. An option could be to use to host your e-mail, and then use the SMTP provided by them to send e-mail from your box. If you want to follow that approach you might start with these links

I hope that helps

by Jesin A
Read through this tutorial to learn how to use Gmail or Yahoo with PHP mail() function.

Hello Roberto

I hope your well.

That’s really good advice.

Thank you so much