PHPMailer with gmail (can I send emails on behalf of@mypersonaldomain.com)

Quick question.

I have a gmail account

ie / myemail@gmail.com

I contacted the email on my website

t /

contact@mydomain.com

Is it possible to use PHPMailer to send email via gmail (for reliability, less likely to get marked as spam, etc.), but I have " contact@mydomain.com " as my sent email ???

I use the code found here:

http://blog.levhita.net/2008/03/13/send-email-using-gmail-and-phpmailer/

So far I have received the error message:

SMTP Error: Authentication Failed.

Thanks.

+4
source share
5 answers

Read this walkthrough: http://deepakssn.blogspot.com/2006/06/gmail-php-send-email-using-php-with.html

You can set "$ mail-> From" to whatever value you want.

+1
source

Go to GMail accounts and import, send mail as you check contact@mydomain.com , and then try. First, make sure the script works in the β€œnormal way." You can also buy GMail for Business (for your domain) and solve the problem.

+1
source

The example does not use SSL, which is required .

$host = "ssl://smtp.gmail.com"; 

Make sure the OpenSSL extension is enabled in php.ini.

0
source

PHPMailer has an example page for gmail.

simple: http://phpmailer.worxware.com/index.php?pg=examplebgmail

and advanced: http://phpmailer.worxware.com/index.php?pg=exampleagmail

You will also download them in the example folder (/examples/test_smtp_gmail_advanced.php)

Use the code to have a working example for PHPMailer and Gmail

0
source

I would recommend creating a free Google Apps account for my mydomain.com domain and using an email account to send your email.

You can configure contact@mydomain.com as an account through Google Apps, and then use this as a sender for your email - the settings for PHPMailer should be the same as for gmail, except for using @mydomain contact. com as your username for authentication (and any password you set up, obviously).

If you want to redirect the email address sent to the contact@mydomain.com address to your gmail account, you can do this the same as for the gmail account .

0
source

All Articles