Syntax:
mail(to, subject, message, headers, parameters)
Parameter | Description |
---|---|
to | Required. Specifies the receiver / receivers of the email |
subject | Required. Specifies the subject of the email. Note: This parameter cannot contain any newline characters |
message | Required. Defines the message to be sent. Each line should be separated with a LF (n). Lines should not exceed 70 characters |
headers | Optional. Specifies additional headers, like From, Cc, and Bcc. The additional headers should be separated with a CRLF (rn) |
parameters | Optional. Specifies an additional parameter to the sendmail program |
PHP Simple E-Mail
The simplest way to send an email with PHP is to send a text email.
In the example below we first declare the variables ($to, $subject, $message, $from, $headers), then we use the variables in the mail() function to send an e-mail:
<?php
$to = “test@example.com”;
$subject = “Test mail”;
$message = “Hello! This is a test email message.”;
$from = “testuser@example.com”;
$headers = “From:” . $from;
mail($to,$subject,$message,$headers);
echo “Mail Sent.”;
?>
PHP Mail Reference
For more information about the PHP mail() function, visit PHP Mail Reference.
Source from: http://www.w3schools.com
I’ve been surfing online more than 3 hours nowadays, yet I by no means discovered any fascinating article like yours. It’s lovely worth sufficient for me. In my opinion, if all web owners and bloggers made excellent content as you did, the web will probably be much more helpful than ever before.
Somebody necessarily assist to make critically articles I’d state. That is the very first time I frequented your web page and so far? I amazed with the research you made to make this particular publish incredible. Fantastic task!
I wish to convey my gratitude for your generosity for all those that should have guidance on this particular study. Your personal commitment to getting the message around became wonderfully valuable and has encouraged professionals like me to reach their aims. Your informative publication implies a great deal to me and a whole lot more to my fellow workers. Thanks a ton; from all of us.
I happen to be writing to let you understand what a wonderful experience my wife’s daughter experienced reading through your blog. She mastered lots of details, most notably what it’s like to possess an awesome coaching mindset to have other people with no trouble understand specified specialized things. You actually did more than our own expected results. Many thanks for presenting the essential, trustworthy, informative as well as unique tips on that topic to Lizeth.