For some days i am trying to send email by using phpmailer which is correctly working on localhost but when i upload same project on the server email not send and also no errors return. this is happening on one.com.
But i have another server with the name inovexi when i upload on this server then email send.
i don't know what is matter actually behind this seen. Please guide me. Thanks.
i have used phpmailer in many projects before. I also have used swiftmailer as well.
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
try {
$mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'blackwindows321@gmail.com';
$mail->Password = 'AB11223344';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom("tayyabeng007@gmail.com", "Artizan");
$mail->addAddress('tayyabeng007@gmail.com', "Artizan");
$mail->addReplyTo('contact@artizan-texhnologies.com', 'reply-artizan');
$mail->isHTML(true);
$mail->Subject = "Artizan Contact Email";
$mail->Body = "This is test message";
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
}
catch (Exception $e)
{
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}