PHPmail, phpmail_PHP tutorial

Source: Internet
Author: User
Tags php mail form
PHPmail and phpmail. PHPmail and phpmailPHP allow you to send emails directly from scripts. The PHPmail () function is used to send emails from scripts. Syntax: mail (to, subject, message, heade PHP mail, phpmail

PHP allows you to send emails directly from scripts.

PHP mail () function

The PHP mail () function is used to send emails from scripts.

Syntax
mail(to,subject,message,headers,parameters)
Parameters Description
To Required. Specifies the email recipient.
Subject Required. Specifies the subject of the email. Note: this parameter cannot contain any new line characters.
Message Required. Defines the message to be sent. LF (\ n) should be used to separate the rows.
Headers

Optional. Specify additional titles, such as From, Cc, and Bcc.

CRLF (\ r \ n) should be used to separate additional titles.

Parameters Optional. Specify additional parameters for the email sending program.

Note: PHP requires an installed and running email system to make the email function available. The program used is defined through configuration settings in the php. ini file. Please read more in our PHP Mail Reference Manual.

PHP simple E-Mail

The easiest way to send an email via PHP is to send a text email.

In the following example, we first declare the variables ($ to, $ subject, $ message, $ from, $ headers), and then in mail () the function uses these variables to send an e-mail:

 

PHP Mail Form

With PHP, you can create a feedback form on your site. The following example sends a text message to the specified email address:

 
 

Example:

1) for windows, you need to configure SMTP for IIS. for linux, you do not need to configure sendmail. The mail function sending function is directly supported.

2) declare SMTP parameters in php. ini

3) use the mail ("receiving address", "email subject", "email content") function

Example 1: configure the local SMTP server

Step 1: php. ini settings:
SMTP = localhost
Smtp_port = 25
Sendmail_from = your set value
Step 2: install the SMTP that comes with IIS. right-click the SMTP virtual server and make the following settings in the pop-up properties window:
Click the "access" tab, click "relay", click "add" in the pop-up window, select "single computer", add IP address as "127.0.0.1", and then

Are returned.

Step 3:
Mail ("123456@qq.com", "Test mail function of PHP.", "hello world! Hovertree.com ");
?>

Recommended: http://www.cnblogs.com/roucheng/p/3528396.html

Http://www.bkjia.com/PHPjc/1125077.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1125077.htmlTechArticlePHP mail, phpmail PHP allows you to send email directly from the script. The PHP mail () function is used to send emails from scripts. Syntax mail (to, subject, message, heade...

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.