PHP Classes

Can't send mail

Recommend this page to a friend!

      pop3.class.inc  >  All threads  >  Can't send mail  >  (Un) Subscribe thread alerts  
Subject:Can't send mail
Summary:My script don't work
Messages:1
Author:bruno starfinder
Date:2007-01-09 21:04:54
 

  1. Can't send mail   Reply   Report abuse  
Picture of bruno starfinder bruno starfinder - 2007-01-09 21:04:54
I've uploaded the next script to my server. But it not works.
I think the code it's ok, right?

$destinat=explode(";",$to_addresses);
$mensaje=$mail_htmlcode;
require "class.phpmailer.php";
$mail = new phpmailer();
$mail->Mailer = "smtp";
$mail->Host = "server.com";
$mail->SMTPAuth = false;
$mail->Username = $SESSION_USERNAME;
$mail->Password = $SESSION_PASSWORD;
$mail->From = $SESSION_USERNAME;
$mail->FromName = $name;
$mail->Subject = $subject;
$mail->Body = $mensaje;
$mail->AltBody = strip_tags($mensaje);
$mail->Timeout=200;

foreach($filex as $key => $value){
$checatipo=explode(".",$filex_name[$key]);
$numext = count($checatipo)-1;
if($checatipo[$numext]=="jpg" or $checatipo[$numext]=="jpeg" or $checatipo[$numext]=="JPG" or $checatipo[$numext]=="JPEG"){$tipox="image/jpeg";}
elseif($checatipo[$numext]=="gif" or $checatipo[$numext]=="GIF"){$tipox="image/gif";}
elseif($checatipo[$numext]=="png" or $checatipo[$numext]=="PNG"){$tipox="image/png";}
else{$tipox="application/octet-stream";}

$mail->AddAttachment($filex[$key],$filex_name[$key],"base64",$tipox);
}

$errors_list=array();
$success_list=array();
foreach($destinat as $address){
if($address!="" && $address!=" " && $address!=" "){
$address=trim($address);
$mail->AddAddress($address);
if(!$mail->Send()){$errors_list[]=$address;}
else{
$success_list[]=$address;
$exito=true;}
$mail->ClearAddresses();
}
}
$mailtroubles=implode(",",$errors_list);
$mailsuccess=implode(",",$success_list);
if ($mail->ErrorInfo=="SMTP Error: Data not accepted") { $success=true; }