PHP provides mail function to send mail. Syntax is:
bool mail ( string $to, string $subject, string $message [,
string $additional_headers [,
string $additional_parameters]] )
We can send mail n number of mail using this function. The great features of mail function is it support additional headers, that helps us to send the Sender’s details including server name and php version, HTML mail etc…
Here am listing a example, that give you a idea about sending HTML mail.
Recipient,You can send to multiple recipients by using comma
$to = 'rep@yahoo.co.in';
Subject
$subject = 'Mark List';
Message
$message = "Any Html Contents";
To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'From: sender ' . "\r\n";
$headers .= 'Cc: rep1@gmail.com' . "\r\n";
$headers .= 'Bcc: rep2@gmail.com' . "\r\n";
// Send Mail
mail($to, $subject, $message, $headers);
Thursday, August 6, 2009
Subscribe to:
Comments (Atom)