SMTP Mail issue

I am working with phpmailer to send my clients a confirmation mail. I am sending my mails vai gmail smtp to other gmail id. Before adding my site to cloudflare, mails were working great and on wapm localhost too but not after adding to cf it’s saying “Error SMTP: could not connect to smtp host”.
here is my code : -

$mail = new PHPMailer();
	$mail->Mailer = "smtp";

	$mail->SMTPDebug  = false;  
	$mail->SMTPAuth   = TRUE;
	$mail->SMTPSecure = "tls";
	$mail->Port       = 587;
	$mail->Host       = "";
	$mail->Username   = $emailusername;
	$mail->Password   = $emailpassword;


	$mail->AddAddress($emailtousername, $emailtoname);

	$mail->SetFrom($emailusername, $emailfromname);

	$mail->Subject = $career_subject;

	$content = '<html>html code</html>';


	if(!$mail->Send()) {
	  } else {

please help me with this issue!

Is the return address of your mail from a @gmail (or your own G-Suite domain) address?

May I ask have you checked similar topics for some help regarding PHPMailer?:

i’ev checked every tutorial but got nothing. i’ev just created two different gmail id’s and want to send mail from one to another, that’s it.

Well, may I ask if PHP mail() function or sendmail() is defined and actually working on your hosting?
Which versioin of PHPMailer are you using?

What do you get when true for SMTPDebug?

Running locally on a home network or?
If so, are the needed ports open and the (sub)domain (un)proxied via Cloudflare? (:orange: or :grey: cloud depending on the needs)

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.