PHPMailer with Gmail (can I send emails from name@mypersonaldomain.com?) [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this questionI have a Gmail account. I.e., myemail@gmail.com.
I have associated my website email to it. I.e., contact@mydomain.com
Is it possible to use PHPMailer to send email via Gmail (for reliability, less likely to get flagged as spam, etc.), but have "contact@mydomain.com" as my sent email?
I'm using the code found here:
Send email using Gmail and PHPMailer
So far I've been getting an error:
SMTP Error: Could not authenticate.
Go to Accounts and Import in Gmail, Send mail as and verify contact@mydomain.com, and then give it a try. First make sure you script is working the "regular way".
You can also buy Gmail for Business (for your domain) and the problem is solved.
The example there does not seem to be using SSL which is required.
$host = "ssl://smtp.gmail.com";
Make sure you have OpenSSL extension turned on in file php.ini.
I'd recommend setting up a free Google Apps account for mydomain.com and using an email account there to send your email.
You could set up contact@mydomain.com as an account through Google Apps, and then use this as the sender for your email -- the settings for PHPMailer should be the same as for gmail except you would use contact@mydomain.com as your username for authentication (and whatever password you set up, obviously).
If you want to forward email sent to contact@mydomain.com to your Gmail account, you can do this just as you would for a Gmail account.
精彩评论