PHP tips: who initiated your mail (), PHP? _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
PHP tips: who initiated your mail (), PHP ?. A strange problem occurs in the number of letters sent by the PHP internal component: Warning: mail (): Failedtoconnecttomailserveratlocalhostport25, when verifyyourSMTPandsmtp PHP sends a letter, a strange problem occurs:
Warning: mail (): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php. ini or use ini_set () in .......
Of course, this color is not displayed on the webpage, but for this reason, but you can set the color of the indicator, this will be worth your consideration.

After searching for related answers over the internet, including related technical blog posts, you can easily explain the solutions. most of the changes are just mentioned: php. the [mail function] function in ini is used to enable the smtp function. The following is a change to the smtp function:
[Mail function]
SMTP = localhost
Smtp_port = 25
Sendmail_from = youremailUsual@domin.com
In this case, it is necessary to explain that this component is From.
Sendmail_path = ""
It is empty at first, and it is explained in the background.
Mail_add_x_header = on
There is no need to change the mechanism of the on statement.

In this step, I have modified and re-installed apache. of course, I actually operated this operation in CMD, I got a little smile. how stupid I am!

After the renewal is completed, refresh the renewal surface.

So far, stackoverflow mentioned IIS (windows-recognized server), which cannot be found in Control Panel-administrative tools, because it is a Windows 7 player, you can just open it under the add and remove programs. pay attention to the operation and you can find it in the management tool, at this time, we can see that all smtp tokens are excited. when zookeeper is opened, the related data is configured, as shown in the screenshot below:

Correction: I forgot to issue a video here. sorry! 7-5 minutes later.


To be honest, what we have done in this step is better than what we have done. the above is ASP.net's choice, which takes care of your PHP affair. [it is not successful anyway].

I tried to solve the problem by checking the smtp protocol in Baiji Baike. Click Here to submit a ticket.
In the future, modify [mail function] as follows:
Take the configuration in the 126 cases box as an example
SMTP = smtp.126.com
Smtp_port = 25
Sendmail_from = my126EmailAddress@126.com
Sendmail_path = ""
Mail_add_x_header = on

At the same time, the value of $ from variation in the program is modified to be consistent.

[Because of the previous modification, add the phpinfo () function to the program. after reading the line, search for mail details in the program, you will find that there is a Localhost Value and master Value. of course, this is a good understanding. Localhost Value refers to the number set in your program, and the master Value is php. settings of ini]
Then, the magic hacker disappears, but the following example appears:
Mail (): SMTP server response: 553 You are not authorized to send mail, authentication is required aaf353e4-8ac5-416e-9cd5-6b54fc592764

After that, I changed the other email boxes, such as QQ and Gamil, as shown in the above prompt. after reading a familiar word authorized, I realized what I meant.

In this step, it seems that success is not successful. I think of the time when I used the client terminal to configure a mailbox for use, in the last step, you will be asked if you need to open the "server identity authentication ". the last one accidentally found a file package called sendmail. The following is the download address: sendmail.
Later, it is best to create a new file named sendmail under the root directory of PHP, and then import the file into the folder and parse it, modify a file called sendmail. ini file, which is modified as follows:

; Take the fomus email provider in China 126 for example
[Sendmail]
Smtp_server = smtp.126.com
Smtp_port = 25
Default_domin = 126.com
Auth_username = strings in your email address before char '@'
Auth_password = your password which allow you to login in your email-box
Hostname = 126.com

Later, you have to modify php. ini, or the old place:
SMTP = smtp.126.com
The same is true for changing to localhost. other options remain unchanged.
Smtp_port = 25
Sendmail_from = my126EmailAddress@126.com
Sendmail_path = "your sendmail path/sendemail.exe-t"
; Of course, the first half of this route must include the root category of your PHP Server and convert "\" "/", I think it is necessary.
Mail_add_x_header = on

After the configuration is complete, refresh your apache, refresh the hosts, and the hosts disappear, because the $ to set in the program is your 126 and QQ hosts box, of course.

I know that I resolve it. the content of the opening component is exactly the same as the content I added to the component, and some content is also exported from the local data volume.

Author: Tian Haoyu

Export Warning: mail (): Failed to connect to mailserver at localhost port 25, verify your SMTP and smtp...

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.