About PHP Mail

Source: Internet
Author: User
Tags configuration settings php mail form

The PHP Mail () function is used to send e-mail from a script.

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

Parameters Description
To Necessary. Specify email recipients.
Subject Necessary. Specify the subject of email. Note: This parameter cannot contain any new line characters.
Message Necessary. Defines the message to be sent. You should use LF (\ n) to separate the rows.
Headers

Optional. Specify additional headings, such as from, Cc, and BCC.

You should use CRLF (\ r \ n) to separate additional headings.

Parameters Optional. Specify additional parameters for the mail sender.

Note: PHP requires an installed and running messaging system to make the mail function available. The program used is defined by the configuration settings in the php.ini file.

PHP Simple e-mail

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

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

<?php$to = "[email protected]"; $subject = "Test mail"; $message = "hello! A simple email message. "; $from = "[email protected]"; $headers = "From: $from"; Mail ($to, $subject, $message, $headers); echo "Mail Sent.";? >
PHP Mail Form

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

email: <input name= ' Email ' type= ' text '/><br/> Subject  : <input name= ' Subject ' type= ' text '/> <br/>  message:<br/>  <textarea name= ' Message ' rows= ' cols= ' > </textarea  ><br/>  <input type= ' Submit '/>  </form> ';  }? ></body>




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.