Well this question was asked to me for more than a couple of times now. So I thought of documenting it here, instead of answering them individually. 🙂
Long time readers of my blog would know that I use Google App for email. Ever since I moved to Linode for hosting, I stopped running a mail daemon in my server, and instead choose to use Gmail’s SMTP server for sending email.
There were two reasons for it. First most email providers ignore or mark as spam, emails sent from non-SMTP servers. Second, removing mail daemon from server will save some resources and will increase the over all performance of my server.
Using SMTP in WordPress
For WordPress there is an excellent Plugin called WP Mail SMTP, which can be used to send email through Google’s SMTP servers.
Download and install the Plugin and in the settings page you have to set the following options.
- SMTP Host: smtp.gmail.com
- SMTP Port: 465
- Encryption: Use SSL encryption
- Authentication: Yes
- Username: Your full Gmail address or Google App email
- Password: your account password
You can also checkout the following screenshot for reference.
I am also working on a Plugin to log all emails sent by WordPress. Expect it to be released soon 🙂 (Update: The Plugin to log all emails is ready. It is called Email Log and you can download it from the Plugins page.)
Update (Oct 2012)
I just realized that these days Google has added additional security for logging in using other clients. If your email is not sent properly after giving correct password, then refer to instructions at Gmail help to fix it.
Also if you have enabled two factor authentication, then refer to this Gmail support page.
how is the smtp log plugin going?
@Scott,
It is available here I have also added the link in the post.
it doesn’t work anymore with wordpress 2.9
Are you getting any specific error message.
Sorry, actually it was crashed during upgrading but it has fixed now. And I use Joomla now, I’ve done with WordPres, hehe..
Btw, you don’t need to use plugin as to it will decrease website performance. Just configure wp-includes/pluggable.php and class-phpmailer.php.
I think Joomla is more fast than WordPress and has more function, ;-).
This is a very subjective sentence and I will not get into it 😉
The reason why we should use a Plugin instead of changing wp-includes/pluggable.php is because, you don’t need to worry about it while updating WordPress. When compared with Joomla, WordPress get’s update pretty frequently 🙂
Absolutely right, that’s why I use Joomla :-D. Well i just need another experience indeed.
While new version of WordPress comes up there are usually some bugs or errors like one I’ve posted in WordPress forum about Category Slug. Maybe that’s why they always go with updates ;-).
However WordPress is the #1 opensource, because everybody uses it, phew.
I would strongly disagree. Not only is the Joomla interface hard to use but the plugins are heavy and slow everything down. Transferring from one server to another is a nightmare. The only thing that annoys me more at this moment is this auto pop-up on every word in this box. Wow, i would never torture a user with this.
yes. now i’m using wordpress again haha … but like usual I don’t use plugin if i could hack the core. 🙂
Nice I will try it with google apps
HI there
Thanks for the post this was good i did figure out early how to use smtp host i am using google aps but i missed out on the port and was using 587 to and i guess that was closed by my host i figured out here that i should try normal ssl and it just worked
I am using c-formII pretty with wp and google apps.
smtp.gmail.com
ssl enabeled – port 465
username and pass it works like a cake
Thanks
just wondering..
wordpress is suppose to be able to send email notifications without the need of a plugin right?
so why must one go through this configuration to get wordpress to send emails?
is it because of the webhost?
p/s: im hosting a wordpress blog but it doesnt seem to send emails out whenever i get comments to be moderated, backup to email as well.
thank you in advance!
Yes if you have sendmail feature enabled on your webhosting service.
If you already have sendmail (Email Server) running on your web server, then you don’t need to install this Plugin or configure anything.
But if you don’t have sendmail installed or don’t want to use it and instead want to use your Gmail or Google Apps account to send emails then you have to configure using the above instructions.
thanks… now i can use sendmail with google application..
Wow that you for that, although I pretty much connect my google to my outlook^^
hi
how can I post to wordpress via gmail please.
I cant work it out
Thanks for the TUT.
But is there a plugin that can do this:
1: Let me compose and send an email to one of the authors of Self Hosted WordPress blog
2: Let me compose the email from Make/Edit Post Page of Admin Panel.
Many thanks for the help.
wordpress is suppose to be able to send email notifications without the need of a plugin right?
so why must one go through this configuration to get wordpress to send emails?
If you already have sendmail (Email Server) running on your web server, then you don’t need to install this Plugin or configure anything.
This Plugin is useful, if you don’t want to run sendmail or any email server on your server and want to offload it to gmail.
Hi!
I get the mails from wordpress whenever I get a comment no prob but I have a related question.
I have different forms on the blog that I want them to send info to different emails than the admin one. Is there an option I didn’t see or is this impossible (doubt it).
The emails are actually mailing lists hosted on my school’s server.
Any ideas?
You can use the contact form Plugin to setup contact forms in your WordPress blog. You can find the Plugin at http://wordpress.org/extend/plugins/contact-form-7/
Thanks! This is going to be usefull when i swith to .org!
Any solution for wordpress.com (since we can’t hack the coding..)
thanks again!
I just noticed my google analytics had hundreds of people hit my contact page, but that I wasn’t getting any email.
I tried to get it working w/ my apps email, but gave up before trying the port you used.
Thank you so much! Seriously awesome.
Hello! Is this pluggin working in 3.04 version?
Becouse it sends me an error in the test. Says “Couldn connect to smtp server”
And all the parameter ( smtp.gmail.com, port, ssl, username(full qith @gmail.com) and password ) are ok.
Any idea?
Mariano,
I guess the Plugin is compatible with 3.0.4 as well. Try to see if your server admin has enabled making SMTP connections from your server.
Great article!. Thanks.
I tried to use this trick but it is not working for me… maybe I did something wrong.
What is the issue that you are facing?
thanks for sharing!! appreciate it!!! =)
You screw Gmail if you do that. You get:
We’ve detected unusual activity on your account. To immediately restore access to your account, choose how to verify your account.
For your security, we strongly recommend running anti-virus software on your computer to detect and remove any malware.
is it possible to use this to “open my gmail account” in a link in my website?
example: I have a site http://www.mateus.com and a email account contact@mateus.com
and I just want a link/button that allows me to open my email, without having to
open a new browser window and typing the user and password.
hope you understand me.
thanks
Thank you so much for the help!
Hello Sudar.. Wanted to ask is there a plugin or will ur plugin help in – integrating a email server along(zimbra, roundcube, etc) with wordpress users.. ?
I think this should help. But I haven’t tried it though.
Thanks Sundar… What I meant was — having all users a email system like a email server.. saying we make a roundcube or a zimbra server and then connect it to wordpress so that all wordpress users will automatically have a email account…. Is that possible
Well, I am not sure if that would be possible.
I’m having some problems with this – I’ve done everything mentioned, but when I send a test email it is received in my gmail account but doesn’t get published on my blog. Any idea why? Thanks for any help
Can Contact Form 7 use SMTP? How, what must I do? Something about changing “mail()” to “wp_mail()” … but where do I find “mail()” to edit and change?
I guess yes. Search the contact form source code and replace mail() with wp_mail().
hi! thanks so much for the information, i’m wondering two things (and i’m *VERY* wordpress/techy challenged).
1. the email plug-in for gmail, when i send an email will it read as name@makemsayom.com (makemsayom being my website)? but the interface will come up as the same I use for gmail now, correct?
2. the plug-in you have for your social network sharing (facebook/twitter/linkdin) in the heart shapes, whats the name of that plug in? it’s perfect!!!
thank you so much for your help 🙂
Mallory
Here are my answers.
1) Yes
2) It’s not a Plugin. It’s part of my theme. http://sudarmuthu.com/wordpress/bright-light
I’ve tried your suggestion, but it still returns
404. Page not found.
Sorry, but you are looking for something that isn’t here.
From where i can use wordpress email function?
You just have to call wp_mail() function call where ever you want. You can also find the reference for this function in WordPress codex.
I can’t get this to work I keep getting:[“language:protected”]=>
array(17) {
[“provide_address”]=>
string(54) “You must provide at least one recipient email address.”
[“mailer_not_supported”]=>
string(25) ” mailer is not supported.”
[“execute”]=>
string(19) “Could not execute: ”
[“instantiate”]=>
string(36) “Could not instantiate mail function.”
[“authenticate”]=>
string(35) “SMTP Error: Could not authenticate.”
[“from_failed”]=>
string(35) “The following From address failed: ”
[“recipients_failed”]=>
string(45) “SMTP Error: The following recipients failed: ”
[“data_not_accepted”]=>
string(30) “SMTP Error: Data not accepted.”
[“connect_host”]=>
string(43) “SMTP Error: Could not connect to SMTP host.”
[“file_access”]=>
string(23) “Could not access file: ”
[“file_open”]=>
string(33) “File Error: Could not open file: ”
[“encoding”]=>
string(18) “Unknown encoding: ”
[“signing”]=>
string(15) “Signing Error: ”
[“smtp_error”]=>
string(19) “SMTP server error: ”
[“empty_message”]=>
string(18) “Message body empty”
[“invalid_address”]=>
string(15) “Invalid address”
[“variable_set”]=>
string(30) “Cannot set or reset variable: ”
}
[“error_count:private”]=>
int(1)
[“sign_cert_file:private”]=>
string(0) “”
[“sign_key_file:private”]=>
string(0) “”
[“sign_key_pass:private”]=>
string(0) “”
[“exceptions:private”]=>
bool(false)
}
The SMTP debugging output is shown below:
SMTP -> ERROR: Failed to connect to server: Connection timed out (110)
SMTP Error: Could not connect to SMTP host.
Did you enter a To address before testing it?
Yes I tried with two different added and same error.
I have fixed this issue and just enter create a session path and configure the same path in php.ini via plesk panel.
It’s possible to use two-factor authentication?
I have not explored it. So not sure if it is possible.
I have updated the post with instructions on how to use SMTP when 2-factor authentication is enabled. Follow the instructions and let me know if you still face any issues.
I am using wp mail smtp plugin.
I have set up setting as bellow
SMTP : smtp.gmail.com
PORT: 465
Encryption : SSL
Tick yes on authitication and provided my gmail account username and password.
But when i test the this setting in below tab, it does not send email it showing following message
“SMTP Connect() Failed” in Error info.
I have also checked some other smtp settings.
my wordpress site is published at localhost:8080/wordpress
Please provide some help on this
I guess this is related to you running WordPress in localhost. Can you try it on an actual domain?
thank you about this article
Can we use gmail SMTP to send a mail from WP 4.2.2 version?
Yes. It works with the latest version of WordPress.
Invaluable comments ! I Appreciate the facts ! Does anyone know where I could find a template a form copy to fill out ?
amazing article..thank you