Setting Up postfix to send outgoing mail on ubuntu

I don't know why but this is one of those things that I find extremely annoying to set up. Mainly because it often requires installing a full-blown MTA to do a much simpler job than it was designed to do. Unfortunately, ssmtp and exim, the only simpler ones, often suck (especially ssmtp, which even the maintainer gave up on). What follows is how I got postfix working on my Ubuntu Feisty machine (should work on more recent version of Ubuntu as well):

sudo apt-get install postfix
sudo dpkg-reconfigure postfix

Here are the options to answer in order:

"satellite" (when given the list of configuration styles)
<your normal user> (where to forward root's mail to)
<your host name>
<your ISP's smtp server>
accept default (when asked what other domains to accept mail from)
No (default is no synchronous updates on mail queue) (accept default unless you know what you are doing)
0 (mailbox limit)
+ (default)
all (default)

Reload or restart postfix, then do some testing:

sudo apt-get install mailx
echo test |mail -s "test mail sent to external" <a href=""></a>
echo test |mail -s "test mail sent to normal user" <normal user name>
echo test |mail -s "test mail sent to root" root

You should get an email to your external address. And if you run


you should see 2 emails there for you, one that was sent to root (but was directed to you, see /etc/aliases for why) and the other that was sent to you.

To have those mails sent to an external address instead (like your address) do the following:

echo > ~/.forward

Update (2007-07-19): When I changed ISPs, my new ISP did not like my From: address being david@centurion (I just named it after the case model). So I had to do the following. Add this to /etc/postfix/

smtp_generic_maps = hash:/etc/postfix/generic

Add this to /etc/postfix/generic:

@centurion      <a href=""></a>

I just made up an email address there to make it happy.
Don't forget to run sudo postmap /etc/postfix/generic


I've got an error on the first message. The message is't delivered and I found a mail in my local mailbox with the following error message:

Diagnostic-Code: smtp; 554 5.7.1 : Sender
address rejected: Access denied

Any idea?

Thanks in advance

I needed to thank you for this extraordinary read!! I unquestionably appreciating each and every piece of it I have you bookmarked to look at new stuff you post.FIFA 18 Gold Buying

The writer of this post has some great writing skills and that is shown here. I think that this writer can go really high places if the writer continues to give us such amazing quality posts as this one. voyance gratuite

A particularly wonderful blog zone. We are really grateful for your blog an area. You will discover a ton of frameworks in the wake of going by your post.stresser

Gracias por este material. He tenido la intención de pedirle que dé un poco más de material sobre este tema para que pueda terminar mi trabajo lo antes posible. Y ahora, me has dado el material que necesitaba. Gracias! hechizos de amor

Splendid work from the author here. The data here is class and the text style utilized is exceptionally refined also. The author has made me very happy with the work here and I look forward to more work like this. Aadhaar Data Upda

It's elusive that one may find great data on this topic yet, the author here has discovered some extremely amazing data. I should disclose to the author that this data is quite helpful for me. Thanks for sharing this with us. christmas casino bonus

There aren't enough words in the Oxford dictionary that can describe just how much I love this article here. This article has helped me to such an extent that all my work for the next month is completed now. hackear facil

Well done! This article is quite splendid and it gives me the data that I required for my task. I adore your work and would love to see more from you later on. Hope you do that soon!

It's hard to discover great data about this post however you've some way or another done that and you have my full regard for doing that. Continue giving us more useful articles this way. Admitcard

This writer is doing some absolutely mind lowing work right now. His composing aptitudes are quite unfathomable to see and each time he posts something on this site, I'm generally among the initial ones to peruse it. pirater Facebook

Thanks for posting this brilliant article. I love the work you've been doing recently and I just hope that you continue to produce the same content that you're producing right now.

I must say this post has been written very well. The information is the perfect amount and the way the information is distributed is brilliant as well. I am very impressed after reading this post. mon site voyance

The essayist of this article has composed this article extremely well. The data in this article is exactly what I anticipated it would be and as a direct result of this data, I'll have the capacity to finish my paper. mastering a and p

A debt of gratitude is in order for the web journal stacked with such a large number of data. Halting by your web journal helped me to get what I was searching for.

Spectacular data shared on this post with us. As an author at one of the best organizations on the planet, I am quite cheerful that I became more acquainted with this data today. Your composition abilities were on point in this post also. ereccion total opiniones

I am charmed that I got the opportunity to peruse this article today. This article has given me some incredible data for my undertaking. Some of my mates required some information on this subject too so I'll impart this to them now. pirater Facebook

Much appreciated such a great amount for sharing this amazing data! I am anticipating see more postsby you! 095dxteam

The content here is just outstanding. With this content, I will be able to complete my project in the fastest time possible and that is something that no one will be able to do. So, that is something incredible for me. avenir amoureux gratuit

You are one of the most consistently best writers of all time and everyone agrees with me on that. Your work every week is excellent to read and I always enjoyed reading your articles. I hope you continue this! Super Bowl 52 Live Stream

This is actually one of the most entertaining articles you've submitted on this site. I honestly had one of the most fun times reading this article and that's just what I was looking for today. You have impressed me a lot! Reputacion Online

If you set out to make me think today; mission accomplished! I really like your writing style and how you express your ideas. Thank you.!
voyance par telephone

Much obliged for sharing us about this upgrade. Trust you won't get tired on making posts as useful as this.!
roofing service

Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing.Darel Lynwood Long

Thanks for the nice blog. It was very useful for me. I'm happy I found this blog. Thank you for sharing with us,I too always learn something new from your post. wp security plugin

Very useful post. This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. Really its great article. Keep it up. barry podistrist

You mentioned in your postifx article that you found a fix for the address rejected issues with the mail relay. would you mind posting it?

I believe I gave the solution in the post:

Add this to /etc/postfix/

smtp_generic_maps = hash:/etc/postfix/generic

Add this to /etc/postfix/generic:

@centurion      <a href=""></a>

I just made up an email address there to make it happy.
Don't forget to run sudo postmap /etc/postfix/generic

i read this topic and installed it but not finish. i can send mail from this user to another user but i can't send mail to external? what do i do to install it?

can I use it with LAMPP php program under ubuntu 8.10?

what is the minimal setup and php-ing I must perform so it will
send me an email using php (on my Lampp server with local host )? (at the first stage doesn't matter if it will
be tagged as spam on my gmail)


Your instructions are right on!

I want my machine to e-mail me if something goes wrong with my software RAID configuration. This post was very helpful.


Add new comment