I can't get emails to work :(

August 4, 2014 1.7k 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 rickyspires.co.uk 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 http://www.youtube.com/watch?v=kdio_MMNqUE

  • First login to the server

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

  • config the main.cf file
    cd /etc/postfix/
    sudo nano main.cf

myhostname = rickyspires.co.uk
virtualaliasmaps = hash:/etc/postfix/virtual
aliasdatabase = hash:/etc/aliases
mydestination = rickyspires.co.uk, 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 rickyspires.co.uk ESMTP Postfix (Ubuntu)

mail to: spangler1@rickyspires.co.uk

501 5.5.4 Syntax: MAIL FROM:<address>

mail from: rickyspires@rickyspires.co.uk (root@rickyspires.co.uk)
250 2.1.0 Ok

rcpt to: spangler1@rickyspires.co.uk
550 5.1.1 spangler1@rickyspires.co.uk: 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

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 https://www.digitalocean.com/community/tutorials/how-to-configure-a-mail-server-using-postfix-dovecot-mysql-and-spamassasin

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 Outlook.com 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

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


Have another answer? Share your knowledge.