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. .