PHP Send e-mail

Source: Internet
Author: User

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

Grammar:
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. Each line should be limited to 70 characters characters.
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.

Instance:

"Utf-8"><title> learning tutorial </title>phpfunction Spamcheck ($field) {//Filter_var () filter e-mail//Use the Filter_sanitize_email filter to remove illegal characters from a string in an e-mail message$field =Filter_var ($field, Filter_sanitize_email); //Filter_var () filter e-mail//verifying the value of an e-mail address using the Filter_validate_email filter    if(Filter_var ($field, Filter_validate_email)) {returnTRUE; }    Else    {        returnFALSE; }}if(Isset ($_request['Email'])){    //send a message if you receive a mailbox parameter//determine if a mailbox is legitimate$mailcheck = Spamcheck ($_request['Email']); if($mailcheck = =FALSE) {echo"Illegal input"; }    Else    {            //Send mail$email = $_request['Email'] ; $subject= $_request['subject'] ; $message= $_request['message'] ; Mail ("[email protected]","Subject: $subject", $message,"From : $email" ); Echo"Thank you to using our mail form"; }}Else{     //Display the form if no mailbox parameters are presentEcho"<form method= ' post ' action= ' mailform.php ' >Email: <input name='Email'Type='text'><br>Subject:<input name='subject'Type='text'><br>Message:<br> <textarea name='message'Rows=' the'cols=' +'> </textarea><br> <input type='Submit'> </form>";}?></body>

PHP Send e-mail

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.