Questions about sending email in PHP

Source: Internet
Author: User
Questions about sending email with PHP

Replace these next variable with your email address and your web address
$yourEmailAddress = "[email protected]";
$yourWebAddress = "www.cyhzxx.com";

Collect Posted variables
$name = $_post[' name '];
$email = $_post[' email '];
$message = $_post[' message '];
Generic subject
$subject = "Message from Visitor";
Header
$header = ' from: '. $yourWebAddress. "\ r \ n". ' Content-type:text/html; Charset=iso-8859-1 ';
Email
$htmlEmail = "




Message from site visitor

Name: ". $name."

Email: ". $email."


Message: ". $message."



";
PHP Mail function
Mail ($yourEmailAddress, $subject, $htmlEmail, $header);
Echo ("Message sent!");
?>

We look at it, meaning is to send other pages submitted to my mailbox, HTML I am familiar with, but PHP do not understand, this code source file is. php, only these code, I hope to help me explain how this is sent, and the fact that the code does not work, My mailbox didn't receive the mail

------Solution--------------------
About the content of the email, the general book is more concise introduction.
$yourEmailAddress = "[email protected]";
$yourWebAddress = "www.cyhzxx.com";
The above variables are assigned values
$name = $_post[' name '];
$email = $_post[' email '];
$message = $_post[' message '];
The above is the post form get
Message from site visitor

Wait for 4 sentences to display the form information obtained
Mail ($yourEmailAddress, $subject, $htmlEmail, $header);
The first parameter: the address to be sent, the second argument: the subject of the message, the third: The message content, looks like the fourth: the form from which address.
That's clear, your code has 。
  • Related Article

    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.