Código PHP:
public function enviar_prueba($asunto, $responder_a, $from_name, $cuerpo, $direcciones)
{
$email = new PhpMailer();
// $email->SetLanguage('es','includes/phpMailer/language/');
if ($this->isSMTPAut) {
$email->isSMTP(); // envio por smtp
$email->Host = $this->host; // smtp
$email->SMTPAuth = true;
$email->Username = $this->user;
$email->Password = $this->pass;
$email->Timeout = 60;
}
// si no tiene from name pongo default
if ($from_name == '')
$email->FromName = $this->defaultFromName;
else
$email->FromName = $from_name;
// si no tiene replayto pungo default
if ($responder_a == '')
$email->AddReplyTo($this->defaultReplayTo);
else
$email->AddReplyTo($responder_a);
// si no tiene asunto pongo default asunto
if ($asunto == '')
$email->Subject = $this->defautAsunto;
else
$email->Subject = $asunto;
$email->From = $this->from;
$email->AltBody = $this->AltBody;
$email->MsgHTML($cuerpo);
// carlo la direcciono o direcciones
$emails = explode(',', $direcciones);
if (count($emails) >= 1) {
foreach($emails as $valor) {
$email->AddAddress($valor);
}
} else {
$email->AddAddress($direcciones);
}
$email->send();
$errores = '';
if ($email->ErrorInfo)
$errores = $email->ErrorInfo . '<br />';
$email->ClearAddresses();
return $errores;
}