In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how to configure phplist and phpmailer to send email via gmail. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The details are as follows:
Generally speaking, as long as you do not use a gmail mailbox, it is enough to use phplist to send mail according to the previous "detailed summary of the phplist configuration method of PHP's mass mail sending system". But if you are as unlucky as I am and have to use an email with ssl authentication like gmail, congratulations, my misfortune has now become your luck. After days of trying, I finally succeeded in combining gmail and phplist. I would like to share my experience here in the hope that it will be useful to all comrades who are in the same situation as me. In addition, the core of phplist is phpmailer, and the solution I propose is mainly around phpmailer, so those who need to use phpmailer to send mail through gmail can also refer to my method.
First of all, send mail through gmail according to the configuration method in "detailed summary of phplist configuration methods of PHP mass mail sending system". When sending test mail, phplist will report the failure of sending email, and there will be an error message "Mailer Error: The following From address failed:..." in the event log (eventlog), saying that there is a problem with the sender's address. Is it possible that you have connected to the smtp server, but is there a problem in sending mail? You can use a method to test whether you are connected to the smtp server or not: I deliberately filled in the password of the mailbox account in the config.php file, and as a result, I still reported the same error when I sent the test email. It seems that I am not connected to the smtp server at all. The error report of phplist is too much.
Knowing that you are not connected to the smtp server means that the problem lies at the heart of phplist's e-mail, another famous open source software, phpmailer.
After checking the information of phpmailer sending gmail email on the Internet, it was found that people said that the old version of phpmailer did not support ssl authentication and could not connect to gmail's smtp server, but this problem has been solved in the new version of phpmailer.
Open lists/admin/phpmailer/ChangeLog.txt and find that the latest version of phplist comes with phpmailer version 1.73, which was released in 2005, which is really not new. So I went to phpmailer's official website and put down the latest 5.1.
I want to first study how the new version of phpmailer solves the problem of ssl verification, so I took a look at some of its own documentation, and happened to find that there is a use_gmail.txt under PHPMailer_v5.1/docs. It seems that the authorities pay more attention to the gmail problem and give a demo for reference. Open a look is indeed a complete php page file, basically modified the file extension, mailbox user name and password can be used, but if only such a modification, access to the test page will be an error, I do not know how the official demo will have such an error, unexpectedly will call an undefined function, and there are some unnecessary components. We just wanted to test whether the email could be sent properly, so I changed it to:
As a result, I found that I still reported an error when I visited this page, which is really helpless. How could the official demo not work?
At this time, I suddenly remembered that there is a file called Note_for_SMTP_debugging.txt under PHPMailer_v5.1/docs. Now I am worried about not being able to connect to the smtp server. I might as well take a look at the debugging methods provided inside.
After opening the file and reading the first line, it lit up in front of my eyes, which is exactly what I need! In fact, the method of use is also very simple, as long as in the
$mail- > IsSMTP ()
Front insert
$mail- > SMTPDebug = 1
You can get more detailed error information at the same time. That's really good stuff ^ _ ^
After modifying it like this, I got a more detailed description when I visited the page-"SMTP-> ERROR: Failed to connect to server: Unable to find the socket transport" ssl "- did you forget to enable it when you configured PHP? (28593608)".
I see, so I opened my php profile (C://Windows/php.ini) to search for ssl, and sure enough, I found an extension about ssl
; extension=php_openssl.dll
It wasn't opened. Remove the previous ";" used for comments, then restart the server and visit the test page use_gmail.php again, with the same error prompt.
There is no way, I looked up the article about php and apache ssl configuration on the Internet, and found that it is not enough to open the ssl expansion module, but also to configure openssl. The configuration method in Windows environment is very simple-find ssleay32.dll and libeay32.dll under the php installation directory, and copy them to the system32 directory under windows (opening extension=php_openssl.dll in php.ini is still necessary). Of course, comrades who do not want to "pollute" the system32 directory can modify the environment variables, as long as ssleay32.dll and libeay32.dll are under the system path. (if you are not using the winidows operating system, please go online to find out how to configure ssl for your operating system. It should not be difficult to find)
Visit use_gmail.php this time and find that it can be sent successfully!
On this basis, the problem of our phplist can also be solved: overwrite the corresponding file in lists/admin/phpmailer with the class.phpmailer.php and class.smtp.php in the new version of phpmailer, and then modify the
$this- > SMTPAuth = true;$this- > Helo = getConfig ("website"); $this- > Host = PHPMAILERHOST
Are:
$this- > IsSMTP (); # Add$this- > SMTPAuth = true;$this- > SMTPSecure = "ssl"; # Add$this- > Helo = getConfig ("website"); $this- > Host = PHPMAILERHOST;$this- > Port = 465 # Add
Where the default port number of phpmailer is 25, which is the port number of most smtp servers, but the port number used by gmail is 465, so reset it.
Thank you for reading! This is the end of this article on "how to configure phplist and phpmailer to send email through gmail". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.