Questions about sending emails using php

Source: Internet
Author: User
Question about using php to send an email & lt ;? Replacethesenexttwovariablewithyouremailaddressandyourwebaddress $ yourEmailAddress & quot; [email & #160; protected] & quot; $ yourWebAddress & quot; question about sending an email using php in ww

// Replace these next two 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! ");
?>

Let's take a look at it. it means you want to send the information submitted by other pages to my mailbox. I am familiar with html, but php doesn't understand it at all. the source code is. php only has these codes. I hope you can help me explain how these codes are used to send emails. The fact is that these codes are useless and my mailbox has not received any emails.

------ Solution --------------------
The e-mail content is generally concise.
$ YourEmailAddress = "[email protected]";
$ YourWebAddress = "www.cyhzxx.com ";
Assign values to variables
$ Name = $ _ POST ['name'];
$ Email = $ _ POST ['email '];
$ Message = $ _ POST ['message'];
The above is obtained from the POST form.
Message from site visitor

The following four sentences are used to display the obtained form information.
Mail ($ yourEmailAddress, $ subject, $ htmlEmail, $ header );
The first parameter is the sent address, the second parameter is the message topic, and the third parameter is the message content. The fourth parameter is the address from which the form is sent.
So clearly, your code has it. .

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.