PhpMailer Internal Server error

0

I had this function running in localhost perfectly, and in all tests it sent the email's correctly but after I put it on my server it no longer sends the email's and gives the error "500 Internal Server error" does anyone know what the problem is? Thank you

function SendMail($subject, $message, $to, $toName){

$mail = new PHPMailer();

// Servidor
$mail->isSMTP();
$mail->Host       = 'xxxxxxxxx';
$mail->SMTPAuth   = true;
$mail->Username   = 'xxxxxxx';
$mail->Password   = 'xxxxxx';
$mail->Port       = xxxx;
$mail->SMTPSecure = false;

// Remetente
$mail->From       = 'xxxxx';
$mail->FromName   = 'xxxx';

// Destino
$mail->addAddress($to, $toName);

// Dados da Messagem
$mail->isHTML(true);
$mail->CharSet    = 'utf-8';
$mail->WordWrap   = 70;

// Mensagem
$mail->Subject    = $subject;
$mail->Body       = $message;
$mail->Altbody    = strip_tags($message);

return $mail->Send();
}

Note: xxx = are my personal data that I did not put here but are correct on my server.

    
asked by anonymous 08.01.2015 / 15:42

1 answer

0

I've been using phpmailer for a while and I've had the same problem as yours, I have two tips to get you through:

1st check if the php openssl module is enabled, phpmailer needs it

2nd if it's Gmail, Hotmail, Yahoo use port 587.

    
08.01.2015 / 20:05