Phpmailer Mass Gmail FAQ

Source: Internet
Author: User
Tags add config end ini connect openssl version gmail mail
1.Could not authenticate   First, if you do not use the loop, it is basically the account or password is wrong;   If you use the loop to Mass, send () method after the end remember to call Smtpclose (), send a shutdown once, Otherwise, you will be able to send only one email and then collapse the second time.       2.Gmail   First, open PHP SSL permissions   PHP Open OpenSSL method, most of the OpenSSL is not open, to enable the need for a simple setting:   windows open method:   1: First check the php.ini, extension=php_openssl.dll whether there is, if there is a way to remove the previous annotation character '; ' If this line does not exist, then add Extension=php_ Openssl.dll.   2: Under the PHP folder: Php_openssl.dll, Ssleay32.dll, Libeay32.dll 3 files copied to windows\system32\   folder.   3: Restart Apache or IIS   at this point, the OpenSSL feature is on.   Linux Open method:   I am using Kam still data Cloud host, PHP version: 5.2.14   The following solution to my host as an example to add OpenSSL module support for PHP.   Some answers on the internet say you want to recompile PHP, add configure parameters, and increase OpenSSL support. Here is a method that requires no recompilation.   If the server has the best PHP installation package file, if deleted, to download and Phpinfo page display version of the same PHP installation files, I am here is php-5.2.14.tar.gz   recommended to Sohu mirror download, NetEase mirror is not found. Address: http://mirrors.sohu.com/php/  Connect to the host with an SSH tool.   # Download to/var/www/php5 directory   CD/VAR/WWW/PHP5   wget http://mirrors.sohu.com/php/php-5.2.14.tar.gz   # Solution Pressure   Tar zxvf php-5.2.14.tar.gz   # Enter PHP OpenSSL extension modules directory   CD php-5.2.14/ext/openssl/ /var/www/php5/bin/phpize # Here for your own phpize path, if not found, use Whereis phpize find   # execution, found that error can not find Config.m4, CONFIG0.M4 is config.m4. Direct rename   mv Config0.m4 config.m4  /var/www/php5/bin/phpize  /configure--with-openssl--with-php-config =/var/www/php5/bin/php-config   make   makes install   # when the installation is complete, a directory of. so files (openssl.so) is returned. Under this directory, copy the openssl.so file to the extension_dir you specified in php.ini (Find in php.ini file: Extension_dir =), my directory here is var/www/php5/lib/php/ Extensions   # Edit php.ini file, add   extension=openssl.so   # Restart Apache at end of file/usr/local/apache2/bin/ Apachectl Restart   is ready, OpenSSL support is now successfully added.       However, Gmail is a troublesome place to do more than that, Gmail now SMTP and POP3 are SSL-encrypted   STEP1. PHP OpenSSL module (extension) support STEP2. Download Phpmailer Library STEP3. Change code ' class.phpmailer.php ' and ' class.smtp.php '   1.phpmailer and SMTP Riga property is_ssl   public $Is _ssl = FA Lse 2.phpThe Smtpconnect method in mailer is passed to the SMTP object   $this->smtp-> is_ssl  =-> $this Is_ssl; The Connect method in 3.smtp adds   if ($this->is_ssl) {$host = ' ssl://' before Fsockopen calls. $host;}         last used method, remember to call the Phpmailer class Oh, not in the code.   Copy Code $mail = new Phpmailer (); $mail->issmtp (); $mail->host = ' smtp.gmail.com '; Your Business Post office domain name $mail->smtpauth = true; Turn on SMTP authentication $mail->smtpsecure = "TLS"; $mail->username = ' * * * @gmail. com '; $mail->password = ' Hu Jintao '; $mail->from = ' * * *; $mail->fromname = ' * * *; $mail->charset = ' UTF-8 '; $mail->encoding = "base64"; $mail->ishtml (TRUE); Send As HTML $mail->subject = ' * * *; Mail title $mail->body = ' * * *; Mail content $mail->altbody = "text/html"; $mail->addaddress (' * * *, ""); $mail->is_ssl = true; $mail->port = 587; if (! $mail->send ()) {       exit ($mail->errorinfo);} $mail->smtpclose (); Unset ($mail); Copy Code     Code section on these, and don't forget to do the appropriate settings in Gmail Oh.  above three steps to complete, you can freely use Phpmailer to send Gmail mail.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.