Code: Select all
<?php
require_once "/home/site/public_html/addons/swiftmailer/lib/Swift.php";
require_once "/home/site/public_html/addons/swiftmailer/lib/Swift/Connection/NativeMail.php"; //There are various connections to use
include("/home/site/public_html/here/connect.inc.php");
$swift =& new Swift(new Swift_Connection_NativeMail());
Swift_CacheFactory::setClassName("Swift_Cache_Disk");
//Then you set up the disk cache to write to a writable folder...
Swift_Cache_Disk::setSavePath("/home/bodheorg/public_html/addons/swiftmailer/tests/tmp");
$message =& new Swift_Message("subject here");
$message->attach(new Swift_Message_Part("some content
footer"));
//Use the Swift_File class
$message->attach(new Swift_Message_Attachment(
new Swift_File("/home/site/public_html/mysite/more/moreissue.pdf"), "newpdf.pdf", "application/pdf"));
$sql = "SELECT * FROM members WHERE 1 AND `trusted` = 1 AND `status` = 0 AND (`email` LIKE '%@gmail.com%' OR `email` LIKE '%@yahoo.%' OR `email` LIKE '%@hotmail.%' OR `email` LIKE '%@rediff%') LIMIT 0,35";
$result = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($result)){
$email=$row['email'];
$recipients =& new Swift_RecipientList();
$recipients->addTo($email);
$swift->batchSend($message, $recipients, "email@domain.org");
mysql_query("UPDATE members SET status = 1 WHERE email LIKE '".$email."%'");
}
echo "Complete";
$swift->disconnect();
?>how to format the mail header properly