Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the use of php mail

Shulou Source: shulou.com Published: 2022-06-03 10:39:27 11月15日 Update

In this issue, the editor will bring you about the usage of php mail. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

The function of php mail is to send e-mail messages directly from the script, and the syntax for this function is "mail (to,subject,message,headers,parameters)", where the parameter to represents the recipient of the message.

This article operating environment: Windows7 system, PHP7.1, Dell G3 computer.

The usage of mail

The mail () function allows you to send e-mail messages directly from the script.

If the delivery of the message is successfully received, true is returned, otherwise false is returned.

Grammar

Mail (to,subject,message,headers,parameters)

Parameters.

To is required. Specify the recipient of the mail.

Subject is required. Specify the subject of the message. This parameter cannot contain any newline characters.

Message is required. Specifies the message to be sent.

Headers is required. Specify additional headers, such as From, Cc, and Bcc.

Parameters is required. Specify additional parameters for the sendmail program.

Description

In the message specified by the message parameter, the lines must be separated by a LF (\ n). Each line cannot exceed 70 characters.

(under Windows) when PHP connects directly to the SMTP server, if a period is found at the beginning of the line, it will be deleted. To avoid this problem, replace a single period with two periods.

Note: you need to keep in mind that just because the mail delivery is accepted does not mean that the mail has arrived at the planned destination.

Examples

Send a simple email:

This is how the editor shares the usage of php mail. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: Messages parameters periods content functions characters recipients messages e-mail scripts syntax parsing success one line professional two small and medium subject between Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Tech Info Huawei MariaDB Shulou Technology