Phpmailer Mass Gmail FAQ _php Tutorials

Source: Internet
Author: User
Tags gmail mail
1.Could not authenticate first, if you do not use the loop, basically is the account or password is wrong, if the use of the loop to Mass, the Send () method after the end remember to call Smtpclose (), send one time off, otherwise it will appear can only send a message, The second time on the collapse of the situation. 2.Gmail First, open PHP SSL permissions PHP Open OpenSSL method, in most cases, OpenSSL is not open, to enable the need to make the following simple settings: windows open method: 1: First check php.ini; extension= Php_openssl.dll is present, if present, remove the previous comment '; ', if it does not exist, add Extension=php_openssl.dll. 2: Speak the PHP folder under: Php_openssl.dll, Ssleay32.dll, Libeay32.dll 3 files copied to the Windows\system32\ folder. 3: Restart Apache or IIS to this point, the OpenSSL feature is turned on. Linux under the Open method: I am using the Brocade Data Cloud Host, PHP version: 5.2.14 The following scenario will take my host as an example to add OpenSSL module support for PHP. Some of the online answers say to recompile PHP, add configure parameters, and increase the support of OpenSSL. Here is a method that does not require recompilation. If the server exists PHP installation package files Best, if has been deleted, to download and Phpinfo page display version of the same PHP installation files, I here is php-5.2.14.tar.gz recommended to Sohu image download, NetEase image not found. The address is: http://mirrors.sohu.com/php/Connect to the host with the SSH tool. # Download to/var/www/php5 directory cd/var/www/php5 wget http://mirrors.sohu.com/php/php-5.2.14.tar.gz # Unzip Tar zxvf php-5.2.14.tar.gz # Enter PHP's OpenSSL Extension Module catalog CD php-5.2.14/ext/openssl//var/www/php5/bin/phpize # Here for your own phpize path, if not found, After using Whereis phpize find # execution, found error cannot find config.m4, config0.m4 is conFig.m4. Directly 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. In this directory, copy the openssl.so file to the extension_dir you specified in php.ini (find in the php.ini file: Extension_dir =), my directory here is var/www/php5/lib/php/ Extensions # Edit the php.ini file, add extension=openssl.so # at the end of the file # reboot Apache to/usr/local/apache2/bin/apachectl restart. You are now successfully adding OpenSSL support. However, Gmail's trouble is more than that, and Gmail's current SMTP and POP3 are SSL-encrypted STEP1. PHP OpenSSL module (extension) SupportStep2. Download Phpmailer libraryStep3. Change code ' class.phpmailer.php ' and ' class.smtp.php ' 1.phpmailer and SMTP Riga property Is_ssl public $Is _ssl = false;2. The Smtpconnect method in Phpmailer is passed to the SMTP object $this->smtp-> Is_ssl = $this Is_ssl; The Connect method in 3.SMTP is preceded by the Fsockopen call. if ($this->is_ssl) {$host = ' ssl://'. $host;} Finally, use the 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 enterprise Post office domain name $mail->smtpauth = true; Turn on SMTP authentication$mail->smtpsecure = "TLS"; $mail->username = ' * * * @gmail. com '; $mail->password = ' ****** '; $ Mail->from = ' * * * '; $mail->fromname = ' * * * '; $mail->charset = ' UTF-8 '; $mail->encoding = "base64"; $mail IsHTML (TRUE); Send As Html$mail->subject = ' * * * '; Message 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 the code part of it, and don't forget to set it up in Gmail. The above three steps completed, you can freely use Phpmailer to send Gmail mail.

http://www.bkjia.com/PHPjc/765063.html www.bkjia.com true http://www.bkjia.com/PHPjc/765063.html techarticle 1.Could not authenticate first, if you do not use the loop, basically is the account or password is wrong, if the use of the loop to Mass, send () method after the end remember to call SM ...

  • 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.