qadenza
qadenza

Reputation: 9293

Sending mail works from localhost but not from remote server

I have the last version of phpMailer (v.5.4.2).

This code sends mail from localhost, using XAMPP, successfully, but on the remote server (000webhost) it doesn't work.

Nothing happens, there is no error message, but simply there is no mail in my inbox, spam or trash folder.

<?php
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth   = true;
$mail->SMTPSecure = "tls";
$mail->Username   = "[email protected]";
$mail->Password   = "mypass";          
$mail->Host       = "smtp.gmail.com";
$mail->Port       = 587;           
$mail->SetFrom('[email protected]', 'Your Name');
$mail->Subject    = "My subject";
$mail->Body    = "My body";
$mail->AddAddress("[email protected]", "Recipient name");
$mail->Send(); 
?>

Upvotes: 0

Views: 1275

Answers (1)

XIII
XIII

Reputation: 2044

Have you contacted the hosting provider to check if they are blocking the outgoing ports or limiting sending through them?

Upvotes: 1

Related Questions