jas4 Posted August 30, 2007 Share Posted August 30, 2007 I'm wanting to write a piece of code that will send an email to a number of different email address's after getting the email address's out of an mysql query. I'm using a while loop to get around every email address, and I want the email address to have html in it. the script I wrote works only for some email address's, for email address's like hotmail and outlook express it gets filtered out by the junk filter. This is the code I've got just now: while ($row = mysql_fetch_array($getEmail)){ $email = $row['memail']; $rand = check_input(random_string('alnum',32));//the random key for every invite $inviteid = "inv".rand(1,100000000000000000); echo $email."<br>"; $to = $email; $from = 'myaddress@mydomain.com'; $subject = 'invite'; $message = "<a href='http://www.mysite.com>Click Here</a>"; //$headers = "From: " . $from . "\r\n"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 7bit\r\n"; $headers .= "From: " . $from . "\r\n"; $mailsent = mail($to, $subject, $message, $headers); } any suggestions for getting through the junk email filters? thanks Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 30, 2007 Share Posted August 30, 2007 It helps if you use more arguments in mail(); mail($to, $subject, $message, $headers, '-f'.$from); Quote Link to comment Share on other sites More sharing options...
jas4 Posted August 30, 2007 Author Share Posted August 30, 2007 hey thanks, adding that small snipet of code works well, are there any other suggestions that can plugged in? 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.