You are hereBlogs / David Grant's blog / Setting Up postfix to send outgoing mail on ubuntu
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 (ssmtp especially which even the maintainer gave up on). What follows is how I got postfix working on my Feisty machine:
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) 127.0.0.0/8 (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" me@gmail.com 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 me@gmail.com address) do the following:
echo me@gmail.com > ~/.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/main.cf:
smtp_generic_maps = hash:/etc/postfix/generic
Add this to /etc/postfix/generic:
@centurion david@telus.net
I just made up an email address there to make it happy.
Don't forget to run sudo postmap /etc/postfix/generic
- David Grant's blog
- 227346 reads
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 think this is your smtp server rejecting the From: address. I have a solution for this as I recently had this problem with my new ISP. I'll put the solution up soon.
Thanks very much for your article. Solved my problems. :-)
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/main.cf:
Add this to /etc/postfix/generic:
I just made up an email address there to make it happy.
Don't forget to run
sudo postmap /etc/postfix/generici 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?
I am also having this same issue. Any help would be great.
thanks mate it worked for me
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)
Thanks
Israel
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.
yeah, i must admit that i had already tried working on it using with those codes in my ubuntu and it works.. i love it.
thanks,
good logo fonts
Ta very much ... worked out the box. 8)
Is there a way to skip postfix to send mail. I have to send mail to my cell phone when postfix is down!!!
I've been searching for this for a week now, followed your suggestions and everything worked fine!
Thanks again!
hi,
I have installed postfix, mailx.
when i sent a command line email
I got the email from Shaunak Chandwadkar shaun@wallpapers.no-ip.org
And when I sent it from php I got reply from
www-data www-data@wallpapers.no-ip.org
where can I change this www-data to webmaster or no-reply
Hi,
Am new to Ubuntu.
Tried your settings as mentioned above, i get this error when try to send mails from outlook express. Without relay i have to set 'my server requires authentication'.
Do i need to confiure something on this server.
The server is Ubuntu Server v12.0
Your server has unexpectedly terminated the connection. Possible causes for this include server problems, network problems, or a long period of inactivity. Account: 'mail.albateeltravel.com', Server: '192.168.1.5', Protocol: SMTP, Port: 25, Secure(SSL): No, Socket Error: 10053, Error Number: 0x800CCC0F
How can i resolve this so that the clients can send VIA this server and if possible change the port on the clients also so as to reduce spamming issues.
please help !
I think you're trying to do something that is beyond the scope of this article. This article was just about sending mail from Ubuntu/Linux. It seems like you want to use your Ubuntu box to send outgoing mail. That is a much more complicated problem.
Thank you so much, this was the last part that was giving me grief in my nagios install!
Thanks for the writeup. I found the article by searching for "ubuntu testing mail" on google. I wanted to find a quick way to test mail sending from webapps on a host on a private network, without having to wade into docs for MTA's.
To confirm, I followed the outlined procedure on ubuntu 12.04. It worked without any problems. The setup just took a few minutes.
That's really a great and informative post. Keep up the good work.
Good tutorial. I also wrote my own tutorial on configuring Ubuntu 12.04 with postfix and dovecot. It covers creating virtual mailboxes so you don't have to create new system accounts for every email address. Check it out: http://www.dev-smart.com/archives/492
Post new comment