Hola a mi me pasa lo mismo solo que la funcion ya estaba hecha y no se por dond pillarla es un script en el cual en la configuracion se puede utilizar sendmail, smtp, o phpmail, si al enviar utilizo la funcion mail() lo envia bien sin duplicar pero si utilizo la funcion nmailer() lo envia duplicado
la funcion nmailer completa es esta
Código PHP:
require('includes/phpmailer/class.phpmailer.php');
function nmailer($recipient, $subject, $body, $from, $fromname, $encode=0, $cc=NULL, $bcc=NULL, $attachment=NULL ) {
global $mailer, $smtp_host, $smtp_helo, $smtp_port, $smtp_auth, $smtp_uname, $smtp_passw, $sendmail_path, $adminmail, $sitename;
$mail = new PHPMailer();
$mail->PluginDir = 'includes/phpmailer/';
$mail->SetLanguage( 'es', 'includes/phpmailer/language/' );
$mail->CharSet = substr_replace(_ISO, '', 0, 8);
$mail->From = $adminmail;
$mail->FromName = $sitename;
$mail->Mailer = $mailer;
// Add smtp values if needed
if ( $mailer == 'smtp' ) {
$mail->Host = $smtp_host;
$mail->Helo = $smtp_helo;
$mail->Port = $smtp_port;
$mail->SMTPAuth = $smtp_auth;
$mail->SMTPKeepAlive = true;
if ( $smtp_auth == 'true' ) {
$mail->Username = $smtp_uname;
$mail->Password = $smtp_passw;
}
} else
// Set sendmail path
if ( $mailer == 'sendmail' ) {
if (isset($sendmail_path))
$mail->Sendmail = $sendmail_path;
}
$mail->Subject = $subject;
$mail->Body = $body;
// activate HTML formatted emails
if ( $encode == '1' ) {
$mail->IsHTML(true);
$mail->AltBody = stripslashes($body);
} else {
$mail->IsHTML(false);
}
if( is_array($recipient) ) {
foreach ($recipient as $to) {
$mail->AddAddress($to);
}
} else {
$mail->AddAddress($recipient);
}
if (isset($cc)) {
if( is_array($cc) )
foreach ($cc as $to) $mail->AddCC($to);
else
$mail->AddCC($cc);
}
if (isset($bcc)) {
if( is_array($bcc) )
foreach ($bcc as $to) $mail->AddCC($to);
else
$mail->AddCC($bcc);
}
if ($attachment) {
if ( is_array($attachment) )
foreach ($attachment as $fname) $mail->AddAttachment($fname);
else
$mail->AddAttachment($attachment);
}
$mail->Send();
if($mailer == 'smtp') {
$mail->SMTPClose();
}
$debug_mode = true; // true = display errors on screen, false = don't display errors
if ($debug_mode == 'true'){
if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
}
}
Que podria ser?
Saludos