New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Force Wordpress to use a external SMTP server instead of a local hosted MTA to send out mails?

in Help
Hello LET Users,
How would you force Wordpress to use a external SMTP server (Windows Live, Zoho, GMail) instead of a local hosted MTA (sendmail, exim, postfix) to send out mails (activation mails, mails about comments and such things)?
I kind of miss that feature in Wordpress or is it hidden somewhere? Haven't used Wordpress for years and feeling lost after starting with it again. Do I need a plugin?
Best Regards,
Neko Shiina-chan
This discussion has been closed.
Comments
You need a plugin to do it - search the plugin directory.
Would http://wordpress.org/plugins/wp-mail-smtp/ do the job?
yup it will. I have written how to Configure WordPress to use SMTP http://namhuy.net/2494/configure-wordpress-to-use-smtp.html
Why not set up a local MTA to relay to another server? This will reduce coupling and dependencies on Wordpress's end and give you more freedom to control outgoing mail. Doing so would be a lot more stable in case of issues with the relay server.
Now I only wonder whether this old thing will work with the latest Wordpress version.
I have exim running. How would I set it up the way you explained?
You could use nullmailer to forward all outgoing mail on your VPS. Better than a WP plugin, because it is a solution for all outbound mail. See here for setup instructions (quite simple): http://blog.bokhorst.biz/6507/computers-and-internet/how-to-setup-a-vps-as-web-server/#setup_email
I can help with Postfix, but I've never used Exim so I recommend taking a look at one of the many tutorials on Exim. This article looks good: https://wiki.debian.org/GmailAndExim4, this one is formated a little better: http://tompurl.com/2011/09/17/exim-gmail-on-ubuntu/.
That's nice, didn't know the Exim had a cli "UI" to help in the configurations.
Any other relay will be configured the same way as Gmail. I made a script to automaticlly configure Postfix to relay to MailGun here if you want to take a look: https://silvenga.com/configure-postfix-to-work-with-mailgun/
It's pretty easy to setup ssmtp if you need to relay.
The year is 2014 and WP still defaults to a local MTA?
I was using msmtp-mta for a nullmailer until recently. It wasn't adding date headers to message though, so I recently switched to using Postfix configured as a nullmailer and am a lot happier.
Since this is about LEB and also for a more easy setup, I recommend using ssmtp or nullmailer instead of postfix. The memory usage of ssmtp and nullmailer is a lot lower. The difference between ssmtp and nullmailer is that the later has message queuing, which is an advantage when (the connection to) the upstream server is not always available (sending messages will be retried).
I am running CentOS 6.5 i686 by the way. Will try out some guides even though they might not fully work as CentOS != Ubuntu or Debian but hey Linux is Linux no matter which distribution.
WordPress (or any PHP script) relies on PHP mail, so the question is not why WordPress defaults to the local MTA, but why PHP defaults to the local MTA. There are PHP libraries to directly use a SMTP server from PHP, but IMHO this is a workaround for a problem that should be solved once at system level and not for each PHP script.
Closed at request of OP.
Ninja post.
You ruined it Microlinux!
It seems inflexible to rely on PHPs limited mail functionality in the world of modern SMTP. Why would you not use a library that allows you to connect to a server of your choice in an efficient manner?