1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
function sendmail($content, $addresses, $subject='', $reply='', $BCC='', $alt='', $attachements='', $debug=0)
{
require_once(FB_ROOT.DS.'classes'.DS.'SMTP'.DS.'class.phpmailer.php');
$mail = new PHPMailer();
$mail->PluginDir = FB_ROOT.DS.'classes'.DS.'SMTP'.DS;
$mail->SMTPDebug = $debug;
$FBConfig = new FBConfig();
if($FBConfig->mailer=='phpmailer')
$mail->IsMail();
else
{
$mail->IsSMTP();
$mail->Host = $FBConfig->smtpHost; // SMTP servers
$mail->SMTPAuth = $FBConfig->smtpAuth; // turn on SMTP authentication
$mail->Username = $FBConfig->smtpUser; // SMTP username
$mail->Password = $FBConfig->smtpPassword; // SMTP password
}
$mail->From = $FBConfig->email;
if(is_array($BBC))
{
foreach($BCC as $user => $address)
{
$mail->AddBCC($address, $user);
}
}
$mail->FromName = $FBConfig->siteTitle;
if(is_array($addresses))
{
foreach($addresses as $user => $address)
{
$mail->AddAddress($address,$user);
}
}
if($reply=='')
$reply=array($FBConfig->siteTitle => $FBConfig->email);
if(is_array($reply))
{
foreach($reply as $user => $address)
{
$mail->AddReplyTo($address, $user);
}
}
$mail->WordWrap = 50;
if(is_array($attachements))
{
foreach($attachements as $attach)
{
$mail->AddAttachment($attach);
}
}
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $content;
$mail->AltBody = $alt;
if(!$mail->Send())
{
return 'Mailer Error: ' . $mail->ErrorInfo;
}else
return true;
} |
Partager