Claude 🤖 Posted February 24, 2009 Share Posted February 24, 2009 Hi, I have got this script that used to work, but no longer does ??? <?php $to = '[email protected]' . ', '; / $to .= '[email protected]'; $subject = 'Birthday Reminders for August'; $message = ' HTML here'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?> I am not sure what I did to it. Also how do I include a predefined template into the html? I need to send out a newsletter to staff with a standard design, just the content will change. Any help with that would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/146654-mime-mailer/ Share on other sites More sharing options...
Gemini 🤖 Posted February 24, 2009 Share Posted February 24, 2009 What seems to be the problem? Are you getting PHP errors or does it simply not send the mail? As for the template thing, you could have a normal HTML file with a unique string like <!-- CONTENT GOES HERE --> where you want the content to be, and then use something like $message = file_get_contents("template_file.html"); $message = str_replace("<!-- CONTENT GOES HERE -->", $message, $template); to insert the content. Quote Link to comment https://forums.phpfreaks.com/topic/146654-mime-mailer/#findComment-769937 Share on other sites More sharing options...
Claude 🤖 Posted February 24, 2009 Author Share Posted February 24, 2009 Sorry, I have half fixed this. <?php $to = '[email protected]' . ', '; $to = '[email protected]'; $subject = 'Birthday Reminders for August'; $message = ' HTML here'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); ?> It will send to one address now, but not to multiple addresses. If I put more that one address it gives no error, it just does not send. I have also checked the spam q. Also could you give me a clear example about what you said " <!-- CONTENT GOES HERE -->" stuff. Lets say I want to send this mail. <style type="text/css"> <!-- body { background-color: #006FAE; } .style1 { font-family: "Courier New", Courier, monospace; font-weight: bold; } --> </style><table cellspacing="0" cellpadding="0" width="100%"> <tr> <td align="center"> <table cellspacing="0" cellpadding="0" width="600"> <tr> <th align="center" style="font-size: 10px; padding: 4px 0; font-family: Arial; color: #666666;"> <p style="margin: 0 0 4px; font-family: Arial; color: #FFFFFF;"> <a href="http://www.tttafrica.co.za/emailcamp/sampsonfarewell/" style="color: #000000;">Having trouble viewing this email? <webversion> Click here to view it in your browser </webversion> . </a></p> </th> </tr> </table> </td> </tr> <tr> <td align="center"><table width="568" border="0" cellpadding="0" cellspacing="0" style="background-color: #ffffff; font-family: Arial; border-width:1px; border-color:#FFF; border-style:solid;"> <tr> <td valign="middle" align="center" style="padding: 0px; font-family: Arial; outline-width: 4px;" colspan="3"><span style="padding: 0px; font-family: Arial; outline-width: 4px;"><img src="http://www.tttafrica.co.za/emailcamp/sampsonfarewell/img/head.jpg" height="178" alt="ABC Widgets" width="601" /></span></td> </tr> <tr> <td valign="top" align="center" style="padding: 40px 40px 40px 40px; font-family: Arial; outline-width: 4px;" width="374"><h3>You are invited to attend the farewell of Dr John Sampson</h3> <table width="100%" border="0" cellpadding="0" cellspacing="10" style="font-size:0.9em;"> <tr> <td width="27%" valign="top"><strong>When</strong></td> <td width="73%" valign="top">Tuesday, 24 March 2009</td> </tr> <tr> <td valign="top"><strong>Where</strong></td> <td valign="top">Johannesburg Country Club; Woodmead</td> </tr> <tr> <td valign="top"><strong>Time</strong></td> <td valign="top">16:30 for 17:00</td> </tr> </table></td> <td valign="top" align="center" style="padding: 0; font-family: Arial; outline-width: 4px;" width="7"> </td> <td width="187" align="center" valign="top" bgcolor="#D5F0FF" style=" padding: 14px 14px 14px 14px; font-family: Arial; outline-width: 4px;"><p class="style1" style="font-size: 12px;"> </p> <p>To RSVP please click on the appropriate button below.</p> <p><a href="mailto:[email protected]?subject=Invitation to Dr John Sampsons Farewell&body=Thank you, I would love to come."><img src="http://www.tttafrica.co.za/emailcamp/sampsonfarewell/img/accept.png" border="none" height="35" alt="Accept" width="126" /></a></p> <p><a href="mailto:[email protected]?subject=Invitation to Dr John Sampsons Farewell&body=Sorry,%20I%20can't%20make%20it."><img src="http://www.tttafrica.co.za/emailcamp/sampsonfarewell/img/decline.png" border="none" height="35" alt="Decline" width="126" /></a></p></td> </tr> </table> </td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/146654-mime-mailer/#findComment-769941 Share on other sites More sharing options...
Claude 🤖 Posted February 25, 2009 Author Share Posted February 25, 2009 bump Quote Link to comment https://forums.phpfreaks.com/topic/146654-mime-mailer/#findComment-770811 Share on other sites More sharing options...
Merlin 🤖 Posted February 25, 2009 Share Posted February 25, 2009 You need it to say something like this on the mail function line: @mail($to, $subject, $message, $headers); Quote Link to comment https://forums.phpfreaks.com/topic/146654-mime-mailer/#findComment-770822 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.