Basically I have a Ubuntu Server machine and I would like an idiot-proof solution for sending emails from my website that is also running in this same machine.

My doubts are:

1) Should I use postfix or there are more simple solutions for an smtp server?

2) Do I need to be able to receive emails as well? I just want to send emails...

3) I did I simple test with postfix that came with my Ubuntu server and the email got sent, but it went to the spam box of my gmail. Anyway to avoid the spam box?

4) The email sender was [email protected]. How do I change that?

Thanks very much!


  • using postfix or sendmail is fine to send- by default it wont recieve emails but allow you too if you want in the future. Also easy to implement form webpage using php send mail features.
    – Piotr Kula
    Dec 19, 2011 at 0:43

9 Answers 9


Desktop Ubuntus choice is the package msmtp-mta (installed as default sendmail replacement).


This is not exactly the solution you said you were looking for, but if you have access to some other smtp server, you can use nullmailer.

It is 93kB installed for karmic, and needs one or two lines of configuration.. :)

Description: simple relay-only mail transport agent Nullmailer is a replacement MTA for hosts, which relay to a fixed set of smart relays. It is designed to be simple to configure and especially useful on slave machines and in chroots.


You don't need to run an SMTP server yourself. You can rig your system to send using a different box's server. For instance, if you have access to your ISP's (or hosting service's) mail server, you can send mail from there.

To give a really useful answer would require actually knowing what you're trying to do--your explanation is really vague. Do you want to send email from a CGI script, or what?


First: You will want to add the possibility to receive mails, and if it's only for Bounces, unless you use an email other than one on the server. If you do, you probably won't need the SMTP server either – every email provider I know provides one by itself.

Postfix is not very difficult to configure, as long as you know what you are doing. You might want to read the Postfix documentation and about mail systems in general.

Yes, this is work, but you chose to run your own server. If you don't want the work, don't run one.

The email sender was [email protected]. How do I change that?

This should be the canonical address rewriting.

About the spam thing: Is your server located at your home? Mails from dialup connections are usually blocked everywhere.


An SMTP server is used to send mail and a POP3 to receive mail. For the spam delivery, I am not sure of what could cause that, because I sent a mail from an application using gmail SMTP detail, but the mail was delivered into my spam mails.

  • 1
    That's not quite correct. SMTP is used to send and receive mail. POP (and IMAP) are what clients use to access a mailbox. Mar 14, 2015 at 22:25

It's possible that your mail was marked as spam because the sender was an obvious default - "mysite.dyndns.org".

To fix that: I'm far from a Postfix expert, but have you looked in /etc/postfix/, probably the file main.cf?

  • in addition many spamlists block dynamic ip addresses
    – Journeyman Geek
    Mar 8, 2010 at 10:37

1) You only need a smtp server if you want to receive email. It is not needed to only send it.

3) the spam box is a function of the receivers email system, not the senders. There is no way to guarantee not to be put in the spam box. You can minimize it by making your messages not look like spam (which is a topic for another question).

4) That is probably the default sender. Whatever api you are using to send mail should allow you to configure that. It should probably be set to an address that can receive mail.

  • 2
    No, You have it wrong with #1. You use an IMAP or POP server for receiving but the SMTP is for sending.
    – Wuffers
    May 25, 2010 at 1:15
  • 5
    @Mr. Man: The SMTP server is on the server you are sending mail to. You don't need a SMTP server to send mail. It can even be done using telnet. Some sites do setup a forwarding SMTP server, which relays the mail to the receiver. IMAP and POP are mail server protocols, used to access mail after it has already been received.
    – KeithB
    May 25, 2010 at 12:21
  • @KeithB: having a real local mailserver (like postfix) can still be useful in case a remote server (including your ISP's relay) isn't reachable for some reason; as it will retry sending the mail later. (It's up to Sergio to decide whether that's really important.)
    – JanC
    Aug 21, 2010 at 22:15

Postfix is dead easy if you aren't going to be relaying mail. Your problem is not Postfix's fault: it sounds as if Postfix is working fine.

Spam: look at SPF — SPF can tell other sites that you have a policy of only sending mail that comes from the same machine. But you'll need to hack DNS to set that up. Use a nameserver checker to see if there aren't any obvious problems, like reverse DNS not being set up on your site: see the SF qn, Nameserver Checker.


Relay the email from your SMTP server to your ISP's SMTP server.

Add the following option to /etc/postfix/main.cf:

relayhost = smtp.yourisp.com

Not the answer you're looking for? Browse other questions tagged .