1

I need to send emails from web application using Gmail accounts. As far as I understand, sending them directly will freeze worker process for quite a long time (it's a Rails app running on Apache/Passenger). So I want to install local SMTP server which will queue the message and send it using Gmail. I have no experience with mail, so I need a server which is extremely easy to set up.

synapse
  • 499
  • 2
  • 6
  • 14

4 Answers4

3

nullmailer is written for exactly this purpose: Just relaying everything to another host.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • It'll hang doing the delivery, though, just like doing it directly. Nullmailer and sSMTP are really only useful for something that insists on calling `/usr/sbin/sendmail` and lacks SMTP capabilities itself. – womble Aug 31 '11 at 10:45
  • Nullmailer has a queue so it won't block the calling application. But if the app requires an SMTP interface, not just the `sendmail` binary, it won't help. – Sven Aug 31 '11 at 11:03
  • Well, knock me down with a feather, so it does. They need more marketing on that feature... – womble Aug 31 '11 at 20:13
2

The easiest one to setup is whatever you're most familiar with. If you're not familiar with any of them, then the easiest is whatever the person you hire to setup your mail server is familiar with. Failing that, I use and recommend Postfix, which has decent documentation and plenty of examples out on the Internet. Other people might recommend Exim, and that's not too bad either.

womble
  • 96,255
  • 29
  • 175
  • 230
0

The statement "I have no experience with mail" and sending bulk emails from web application, taken together, are really a recipe for grief (like being blacklisted for having unwittingly mailbombed some poor unsuspecting schmuck, etc.).

I don't want to preach, but you should really either get a good understanding of what you are getting into or find somebody who already has it.

This said, these days most servers are quite easy to set up for what you want to do. I am partial to sendmail/fedora/redhat/centos, so:

# yum -y install sendmail sendmail-cf

[edit /etc/sendmail.mc and change the line:

dnl define(SMART_HOST',smtp.your.provider')

to look like:

define(SMART_HOST',smtp.gmail.com')

or whatever google says you must use]

# chkconfig sendmail on

# service sendmail start

Cheers.

Alien Life Form
  • 2,309
  • 2
  • 21
  • 32
  • 1
    Sendmail as answer to "easiest MTA to setup" is _REALLY_ an interesting point of view. I guess you're maybe one of the handfull of people on plant earth that hold that view. Sendmail is known to make grown up man cry. – pfo Aug 31 '11 at 12:00
  • You missed the ''for what you want to do'' bit. For that task, 4 shell commands are required, which counts as easy in my book. As far as sendmail being complex: easy it ain't, but most of the bad reputation comes from trying to tinker with sendmail.cf (which was somewhat wrong-headedly advised by the bat book) - something I have not been doing since the good ole 90s. Use your distro sendmail.mc, and the ugly syntax goes away.I know some other mail MTAs style themselves as easy - I have tried qmail and found it bewildering. But that's just me. – Alien Life Form Aug 31 '11 at 14:39
  • Just to clarify further: the box set up as reccomended will either send right away or queue and then try to send through gmail's smtp smarthost any piece of mail that is locally submitted. Assuming you're allowed to do it; assuming google's server thinks you're in good standing; etc. – Alien Life Form Aug 31 '11 at 14:51
  • 1
    Don't gmail's servers require authentication before they'll let you wildly relay through them? You're getting far beyond four shell commands for that... – womble Aug 31 '11 at 20:15
  • The assumption seems reasonable. But then they also make you put stuff in the dns to verify ownership, so I'd have to read up on the FAQs to check and I'm too lazy for that. Assuming they do, and assuming it's sendmail 8.12 or later you need 1 shell command and 1 edit more [continued below] – Alien Life Form Sep 01 '11 at 10:11
  • (courtesy of [http://www.linuxquestions.org/questions/linux-software-2/sendmail-authentication-for-smart_host-relay-354488/] Insert into /etc/mail/access `AuthInfo:your.isp.net "U:smmsp" "I:user" "P:password"` Use your ISP, leave "U:smmsp" as is, insert your user and password Then `# makemap hash /etc/mail/access.db < /etc/mail/access` Restart sendmail. If it's < 8.12 it is longer and the link above has all the gorier stuff. [...continued..] – Alien Life Form Sep 01 '11 at 10:13
  • *IF* they also want tls, then it does become hairier and the OP would likely be in medium-depth yoghurt. However that has got nothing to do with sendmail, rather with the cockamamie schemes that are tls, certificates, CAs. I doubt other MTAs can make THAT easier. This is all assuming the pieces fit seamlessly together. The **real** fun starts when they don't. Cheers. – Alien Life Form Sep 01 '11 at 10:15
0

I have no experience with mail, so I need a server which is extremely easy to set up.

There is no mail server software that meets this criterion. If you want to setup email sending from your app without being blacklisted, use a service.

I use Mailjet. It has the best free plan IMO.

I also like Mandrill, Mailgun, Postmark. Sendgrid looks pro but expensive. But seriously, if you don't know a ton about linux admin, setting up an email server is an exercise in futility. And one misstep, then you start getting blacklisted, then it's all over (you'll have to change the IP addresses of all your sending servers).

We were landing in the Spam box all over the place until we switched over to them. If you don't enjoy spending 200+ hours familiarizing yourself with 1970s-era software and protocols, just use a service.

I don't know why this is downvoted. This is the only viable option for a linux mail admin noob. That, spend the (copious) hours, or hire someone who knows what they're doing.

Duke
  • 119
  • 3
  • +1 from me even if that annoys some. The advice to use a service (assuming the service is legit) if you dont want to mess with the gritty details is good. Otherwise, if you want to send locally: ssmtp is another good tool. just do not use non-queueing mailers like ssmtp, nullmailer to send to actual inbound MXes, you will get into issues with greylisting. – rackandboneman May 31 '12 at 20:54
  • The OP clearly stated that he intends to relay everything through Gmail already. While the other services are certainly useful, they aren't really necessary here. – Michael Hampton Sep 17 '15 at 02:55