Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // To send HTML mail, the Content-type header must be set
- $headers = 'MIME-Version: 1.0' . "rn";
- $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
- // Additional headers
- $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "rn";
- $headers .= 'From: Birthday Reminder <birthday@example.com>' . "rn";
- $headers .= 'Cc: birthdayarchive@example.com' . "rn";
- $headers .= 'Bcc: birthdaycheck@example.com' . "rn";
- // Mail it
- mail($to, $subject, $message, $headers);
- // Setup recipients
- $to = 'johndoe@google.com' . ',' // comma separates multiple addresses
- $to .= 'janedoe@msn.com';
- // subject
- $subject = 'PHP Email Script - Test Email';
- // message (to use single quotes in the 'message' variable, supercede them with a back slash like this--> '
- $message = '
- <html>
- <head>
- <title>PHP Email Script</title>
- </head>
- <body>
- <p style="background: #ccc; width: 100%;">Test Email Script</p>
- </body>
- </html>
- ';
- // To send HTML mail, the Content-type header must be set
- $headers = 'MIME-Version: 1.0' . "rn";
- $headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";
- // Additional headers
- $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "rn";
- $headers .= 'From: Birthday Reminder <birthday@example.com>' . "rn";
- $headers .= 'Cc: birthdayarchive@example.com' . "rn";
- $headers .= 'Bcc: birthdaycheck@example.com' . "rn";
- // Send the email
- mail($to, $subject, $message, $headers);
- $email_templates = array('text/html' => 'email/html/' . $template . '.en.html.tpl',
- 'text/plain' => 'email/text/' . $template . '.en.txt.tpl');
- foreach ($email_templates as $type => $file) {
- if ($email->template_exists($file)) {
- $message->attach(new Swift_Message_Part($email->fetch($file), $type));
- } elseif ($type == 'text/plain') {
- throw new Exception('Could not send email -- no text version was found');
- }
- }
Add Comment
Please, Sign In to add comment