DarkPrince2005 Posted February 27, 2008 Share Posted February 27, 2008 Is there anyway i can make the email to not be recognised or sent as junkmail <?php $filename='test.txt'; $arremails=file($filename); for ($i=0;$i<=$arremails; $i++){ $subject = 'Test HTML email'; //create a boundary string. It must be unique //so we use the MD5 algorithm to generate a random hash $random_hash = md5(date('r', time())); //define the headers we want passed. Note that they are separated with \r\n $headers = "From: email@isp.co.za\r\nReply-To: email@isp.co.za"; //add boundary string and mime type specification $headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; //define the body of the message. ob_start(); //Turn on output buffering ?> --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit [i][b]Plain text email[/b][/i] --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit [i][b]HTML Formatted mail[b][/i]--PHP-alt-<?php echo $random_hash; ?>-- <? //send the email //copy current buffer contents into $message variable and delete current output buffer $message = ob_get_clean(); mail($arremails[$i], $subject, $message, $headers); }; ?> Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted February 27, 2008 Share Posted February 27, 2008 proper headers is the biggest thing Quote Link to comment Share on other sites More sharing options...
DarkPrince2005 Posted February 27, 2008 Author Share Posted February 27, 2008 and what would the proper headers look like Quote Link to comment Share on other sites More sharing options...
haku Posted February 27, 2008 Share Posted February 27, 2008 To prevent this, mail has to be sent as SMTP mail. You can do this using the phpmailer class (its free, google it) and set the mail to be isSmtp() 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.