Código PHP:
<?php
include "sistema/config.php";
mysql_connect($server, $db_user, $db_pass) or die (mysql_error());
$result = mysql_db_query($database, "select * from $table order by username asc") or die (mysql_error());
if (mysql_num_rows($result)) {
echo "<font size=3 color=#FFFFFF>Tratando de enviar el mensaje...<br><br>";
while ($qry = mysql_fetch_array($result)); {
echo "$qry[email];<br>";
}
}
require_once('class.phpmailer.php');
$mail = new PHPMailer(); // defaults to using php "mail()"
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->AddReplyTo("[email protected]","Storm of Sighs");
$mail->SetFrom('[email protected]', 'Storm of Sighs');
$mail->AddReplyTo("[email protected]","Storm of Sighs");
$address = "$email";
$mail->AddAddress($address, "Storm of Sighs");
$mail->Subject = "Ignorad este correo";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAttachment("objetos/firma.jpg"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>