I’m trying to send a HTML style email (to 2 x receipents) with attachment using PHP.
I want this email to be received in my GMAIL inbox.
Upkn testing, I am not receiving any email. Please could I have some help getting this code to work or an alternative suggestion please?
Here is my code:
`<?php
// Multiple recipients
$to = ‘[email protected]’ . ‘, ‘; // Note the comma
$to .= ‘[email protected]’;
// Subject
$subject = 'Birthday Reminders for August';
// Message
$message = '
<p>Here are the birthdays upcoming in August!</p>
';
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=UTF-8' . "rn";
// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "rn";
$headers .= 'From: Danniella Lucien Reminder <[email protected]>' . "rn";
// Mail it
mail($to, $subject, $message, $headers);
?>`
I’ve tried re-writing my PHP codeseveral times and no luck. Any suggestions would be appreciated. Thanks
Mark Junior is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.