Version: beta 1.0
Type: Sample Code (HOWTO)
Category: File Management
License: GNU General Public License
Description: a script to send mails reading from 2 different files
make emails.dat file for email addresses
make temp.dat file for the material to be delivered
change the mail server name to your mail server name and thats all enjoy !!!
<table width="75%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr bgcolor="#999933"> <td> <div align="center"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif" size="3"><b>Mail Sending Process <? echo "Sending file $news to users" ?> </b></font></div> </td> </tr> </table> <?php if (file_exists ($news)){ $file = fopen($news, "r"); $file2 = fopen("emails.dat", "r"); if (!$file) { echo "<p>Unable to open remote file.n"; exit; } if (!$file2) { echo "<p>Unable to open remote file.n"; exit; } while (!feof($file)) { $customerservicemail_content = $customerservicemail_content . fgets($file, 1024); } while (!feof($file2)) { $line = fgets($file2, 1024); ?> <div align="center"> <table width="75%" border="2" cellspacing="0" cellpadding="0"> <tr bgcolor="#CCFFCC"> <td><? echo "Sending mail to :>> $line"; $mail_subject = "Customer Service Request "; $customer_Support_mail = $line; $from_mail_address = "[email protected]"; $headers = "From: Acropolis staffn"; $headers .= "Content-Type: text/html; charset=iso-8859-1n"; if(!mail("$customer_Support_mail","$mail_subject", "$customerservicemail_content","$headers")) echo "<hr> Mail cannot be send <hr>"; echo "<br>" ?> <div align="center"></div> <div align="center"></div> </td> </tr> </table> </div> <? } fclose($file2);} else echo "The file $news does not exist"; ?> <div align="center"><a href="index.php3">Send more mails</a> </div>