PeggyBuckham Posted December 17, 2009 Share Posted December 17, 2009 I've set up a system for my client to dynamically make a web page. Now what I'm working on is the best way to send that page out in an email. I tried using an I frame, but I noticed that some browsers don't accept iframes. Here is my code: if($_POST['send_email']){ $to = 'mememe@yahoo.com'; $subject = 'Test Test'; $message = '<p>Having trouble reading this email? <a target="blank" href="http://www.example.com/email.php?id='.$row['id'].'">View it on your browser</a><br/><br/></p><iframe src="http://www.example.com/email.php?id='.$row['id'].'" style="border:none;background:#bedae5;margin:auto;" name="test" width="100%" height="500px"></iframe>'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: noreply@example.com' . "\r\n"; mail($to, $subject, $message, $headers); } Quote Link to comment Share on other sites More sharing options...
Peggy Posted December 20, 2009 Share Posted December 20, 2009 I solved my problem, Here is the answer I used the file_get_contents() function. to grab the html code from the page I wanted to send out as a email. Then I had to change all the CSS in that page to inline styles, I -of course- had to put absolute addresses on all images. Below is the code I used. if($_POST['send_email']){ $to = 'meme@yahoo.com.com'; $subject = 'Test From Example'; $message = file_get_contents('http://www.example.com/email.php'); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: info@example.com' . "\r\n"; mail($to, $subject, $message, $headers); } Quote Link to comment Share on other sites More sharing options...
Peggy Posted December 20, 2009 Share Posted December 20, 2009 Here is the next part of this puzzle that I don't know how to do. I want to send this email out to a long list of email recipients. I know how to pull the list of recipients out of the data base and send this email. What I need is to space the interval between each email sent. I want to send out the emails (200 of them) 1 every 5 seconds. This is so they won't be marked as spam. Am I going to have to mix java script with php? Is there a php function I can use. Quote Link to comment Share on other sites More sharing options...
teamatomic Posted December 20, 2009 Share Posted December 20, 2009 sleep() But you might end up with the script timing out so you might have to split up your recipient list. HTH Teamatomic Quote Link to comment 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.