<?php
require_once('class.phpmailer.php');
require_once 'Excel/reader.php';
//$myid=$_REQUEST['myid'];
//$mypass=$_REQUEST['mypass'];
//$msg=$_REQUEST['msg'];
define('GUSER', '[email protected]'); // Gmail username
define('GPWD', 'pass'); // Gmail password
function smtpmailer($to, $from, $from_name, $subject, $body) {
global $error;
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 0; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
$mail->Host = 'smtp.aol.com';
$mail->Port = 465;
//$mail->AddAttachment('upload/logo.png', 'logo.png');
$mail->Username = GUSER;
$mail->Password = GPWD;
$mail->SetFrom($from, $from_name);
$mail->IsHTML(true); // send as HTML
$mail->Subject = "This is the subject";
//$mail->MsgHTML(file_get_contents('test.html'));
$mail->Body = $body;
$mail->AddAddress($to);
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}
}
// initialize reader object
$excel = new Spreadsheet_Excel_Reader();
// read spreadsheet data
$excel->read('Book1.xls');
// iterate over spreadsheet cells and print as HTML table
$x=1;
while($x<=$excel->sheets[0]['numRows']) {
$y=1;
while($y<=$excel->sheets[0]['numCols']) {
$cell = isset($excel->sheets[0]['cells'][$x][$y]) ? $excel->sheets[0]['cells'][$x][$y] : '';
smtpmailer($cell, '[email protected]', 'name', 'Subject', 'trying the aol');
$y++;
}
$x++;
}
?>
Ce serveur peut-il voir l'hôte SMTP via la ligne de commande (ping, ftp, telnet etc.)? – ChrisF
comment puis-je vérifier cela ?? – chill
Plus d'infos? La connexion réseau et la résolution de noms DNS fonctionnent-elles? Quelle est la version de PHP, le logiciel serveur et la version, les détails de configuration de PHP, et ainsi de suite ... Les boules de cristal sont assez chères de nos jours ... –