php sending mail but gmail not receiving.

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4

45 Replies - 1812 Views - Last Post: 14 July 2020 - 03:11 AM Rate Topic: -----

#31 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 393
  • Joined: 13-March 18

Re: php sending mail but gmail not receiving.

Posted 03 June 2020 - 04:07 AM

what configuration is that?

because i remember putting in accounts here.

https://ibb.co/GtyQsy3

check that link it a screenshot of my database virtual_users. Was this what you were reffring to?
Was This Post Helpful? 0
  • +
  • -

#32 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 393
  • Joined: 13-March 18

Re: php sending mail but gmail not receiving.

Posted 03 June 2020 - 05:56 AM

WOAH! i did slight changes flushed my dns again and sent an email and got this score.

https://www.mail-tes.../test-38w40jo78

for the DKIM part here is my updated code.

	
		$mail->DKIM_domain = $site;
	$mail->DKIM_private = "rsa.private";
	$mail->DKIM_selector = $sitename."-64839v5873958h3ddrg";
	$mail->DKIM_passphrase = "";
	$mail->DKIM_identity = $mail->From;



and the dns entries

 truebud.ca text = "truebud-64839v5873958h3ddrg._domainkey.truebud.ca k=rsa\; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQChKyCHHZEkrYfTdcB2VX0nKL8Vhicb+xQsNswOgo5+IK2ipg97VJb+lKAT+jHMXyk4KPTkUUI/8rwa2IfUKsr/BQXy6csNkmM0Y00H5/+QRAYn+ktoRWO1zXvO2sygzCELgGxcj5pHkOd4xLGhTnTpHh7UAjTp" "/swV5E18dpAubQIDAQAB"
 truebud.ca text = "v=DMARC1\; p=none"
 truebud.ca text = "v=spf1 a mx ip4:216.221.70.222 ~all"
 truebud.ca text = "_domainkey.truebud.ca o=~\; [email protected]"


This post has been edited by Bobby_Bubbles: 03 June 2020 - 09:19 AM

Was This Post Helpful? 0
  • +
  • -

#33 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6876
  • View blog
  • Posts: 31,667
  • Joined: 10-May 07

Re: php sending mail but gmail not receiving.

Posted 03 June 2020 - 09:32 AM

View PostBobby_Bubbles, on 02 June 2020 - 06:18 PM, said:

figured. but rvealing my true ip just like that eh.......would b good to get behind a proxy but that will come later.

You need to expose the true external ip of a mailserver for reverse DNS & PTR lookups.
Was This Post Helpful? 0
  • +
  • -

#34 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 393
  • Joined: 13-March 18

Re: php sending mail but gmail not receiving.

Posted 03 June 2020 - 09:49 AM

yea past that im just stuck on dkim now.
Was This Post Helpful? 0
  • +
  • -

#35 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 393
  • Joined: 13-March 18

Re: php sending mail but gmail not receiving.

Posted 03 June 2020 - 01:28 PM

i was able to resolve it.

mail-tester.com/test-m2rcvr19s

only thing im dealing with is DMARC and the rDNS which im unsure how to resolve.
Was This Post Helpful? 0
  • +
  • -

#36 nicephotog   User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 36
  • Joined: 06-June 20

Re: php sending mail but gmail not receiving.

Posted 24 June 2020 - 05:37 AM

How about $limit = 2; ???
Was This Post Helpful? 0
  • +
  • -

#37 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 393
  • Joined: 13-March 18

Re: php sending mail but gmail not receiving.

Posted 08 July 2020 - 06:55 AM

the script was working but now hotmail isnt getting it now. what is going on here?

<?PHP
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
use PHPMailer\PHPMailer\PHPMailer;
//use PHPMailer\PHPMailer\Exception;
require 'vendor/phpmailer/src/Exception.php';
require 'vendor/phpmailer/src/PHPMailer.php';
require 'vendor/phpmailer/src/SMTP.php';
$site = 'truebud.ca';
$sitename = 'TrueBud';
$host 	= 'localhost';
$user 	= 'truebud';
$pass 	= 'pass';
$db 	= 'truebud';
$conn 	= mysqli_connect($host,$user,$pass,$db);
//$sql = mysqli_query($conn,"SELECT DISTINCT meta_value FROM wp_usermeta WHERE meta_key='billing_email'")or die(mysqli_error($conn));
$sql = mysqli_query($conn,"SELECT DISTINCT email_address FROM mt_client LIMIT 1")or die(mysqli_error($conn));
while($em = mysqli_fetch_array($sql)){
	$mail = new PHPMailer(true);
	echo 'Email Sent to '.$em['email_address'].' - ';
	//echo 'Email Sent to '.$em['meta_value'].' - ';
	try {
		//$mail->isSMTP();                                            // Send using SMTP
		$mail->Host       = $site;                    // Set the SMTP server to send through
		$mail->SMTPAuth   = true;                                   // Enable SMTP authentication
		$mail->Username   = '[email protected]'.$site;                     // SMTP username
		$mail->Password   = 'tbgetin';                               // SMTP password
		$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;         // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
		$mail->Port       = 587;                                    // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
		$mail->setFrom('[email protected]'.$site,$sitename);
		//$mail->addAddress($em['meta_value']);
		//$mail->addAddress($em['email_address']);
		$mail->addAddress('[my_email]');
		$mail->addAddress('[email protected]');
		$mail->addReplyTo('[email protected]'.$site,$sitename);
		$mail->addCC('[email protected]'.$site);
		$mail->addBCC('[email protected]'.$site);
		//$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
		//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
		$mail->isHTML(true);                                  // Set email format to HTML
		$mail->Subject = $sitename.' New Products!';
		$mail->Body    = '<html><head><link rel="stylesheet" href="https://www.truebud.ca/css/css.css"></head><body><center><table style="border: 1px solid black;" width="50%"><tr><td><div style="padding: 5px;"><div style="text-align:center;"><img src="https://www.truebud.ca/truebudlogocml.jpg" alt="logo.jpg"/></div>New Products!<br/><br/>
		
		We are always aiming to providing the best products to our customers all year round and with that Truebud just got some heavy hitters in our inventory and we would love to share it with you.<br/><br/>
		
		We are easily found at <a href="https://www.truebud.ca">www.truebud.ca</a> or at <a href="tel:226-759-8279">226-759-8279</a> available at Windsor and Essex county from 10am-midnight. <br/><br/>
		
		We appreciate your business and look forward to serving you in the future.<br/><br/>
<table style="padding 10px;">
<tr>
	<td><img src="https://truebud.ca/wp-content/uploads/2020/07/1594132035118.jpg" alt="Romulan.jpg" width="75" height="75"/></td>
	<td><a href="https://truebud.ca/product/romulan/"><div style="font-size: 24px;">Romulan</div></a>210$</td>
</tr>
<tr>
	<td><img src="https://truebud.ca/wp-content/uploads/2020/07/1594132039623.jpg" alt="Violator.jpg" width="75" height="75"/></td>
	<td><a href="https://truebud.ca/product/violator/"><div style="font-size: 24px;">Violator</div></a>210$</td>
</tr>
</table></div></td></tr></table></center></body></html>';
		$mail->AltBody = 'New Products!
		
		We are always aiming to providing the best products to our customers all year round and with that Truebud just got some heavy hitters in our inventory and we would love to share it with you.
		
		We are easily found at www.truebud.ca or at 226-759-8279 available at Windsor and Essex county from 10am-midnight. 
		
		We appreciate your business and look forward to serving you in the future.';
		$mail->AddCustomHeader("List-Unsubscribe: <mailto:[email protected]".$site."?subject=Unsubscribe>,<http://".$site."/unsubscribe.php>");
		$mail->DKIM_domain = $site;
		$mail->DKIM_private = "rsa.private";
		$mail->DKIM_selector = $sitename."-64839v5873958h3ddrg";
		$mail->DKIM_passphrase = "";
		$mail->DKIM_identity = $mail->From;
		$mail->send();
		echo "Message has been sent \r\n";
	} catch (Exception $e) {
		echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}.Email Deleted \r\n";
	}
}
echo "\r\nDone sending ".mysqli_num_rows($sql)." emails\r\n\r\n";
?>



hotmail/live is not receiving i anymore. i didnt make any changes and was working before. how can i troubleshoot where the problem is coming from?
Was This Post Helpful? 0
  • +
  • -

#38 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6876
  • View blog
  • Posts: 31,667
  • Joined: 10-May 07

Re: php sending mail but gmail not receiving.

Posted 08 July 2020 - 08:32 AM

If you didn't make any changes, then why do you think it's the code? I would go back to testing validation of sending from the domain to the domain. Then you know the code works. Work from there.
Was This Post Helpful? 0
  • +
  • -

#39 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 393
  • Joined: 13-March 18

Re: php sending mail but gmail not receiving.

Posted 08 July 2020 - 10:09 AM

gmail gets it fine.

i was thinking maybe my code is missing a header that is now required.
Was This Post Helpful? 0
  • +
  • -

#40 ArtificialSoldier   User is online

  • D.I.C Lover
  • member icon

Reputation: 2760
  • View blog
  • Posts: 8,067
  • Joined: 15-January 14

Re: php sending mail but gmail not receiving.

Posted 08 July 2020 - 10:32 AM

Maybe so, but you'll need to research the requirements for Hotmail. They are getting the mail, they just aren't delivering it.
Was This Post Helpful? 0
  • +
  • -

#41 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6876
  • View blog
  • Posts: 31,667
  • Joined: 10-May 07

Re: php sending mail but gmail not receiving.

Posted 08 July 2020 - 10:58 AM

View PostBobby_Bubbles, on 08 July 2020 - 12:09 PM, said:

gmail gets it fine.


On an account where you clicked "This is not spam"?

You're looking at spam way too binary. Each major, especially free, provider is going to treat things differently. You're going to have a difficult, if not impossible time, with a coding approach each time someone rejects an email as spam. Things from IP pool, IP score, previous IP owner, domain, reverse dns, PTR, DKIM, etc, are all going to effect spam evaluation.
Was This Post Helpful? 0
  • +
  • -

#42 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 393
  • Joined: 13-March 18

Re: php sending mail but gmail not receiving.

Posted 08 July 2020 - 11:25 AM

the email just gets sent to spam usually. i did whitelist it and its still not getting delivered.

i have to send an email to office 365 to delist my ip address apparently. not entirely sure if this will resolve it but its the only thing i can think of.
Was This Post Helpful? 0
  • +
  • -

#43 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6876
  • View blog
  • Posts: 31,667
  • Joined: 10-May 07

Re: php sending mail but gmail not receiving.

Posted 08 July 2020 - 11:38 AM

If it resolves it, it may not be the resolution for the rest of the world.

View PostBobby_Bubbles, on 08 July 2020 - 01:25 PM, said:

i did whitelist it and its still not getting delivered.

If you did this in the 'hotmail' client, it's still getting thrown away by the MTA.
Was This Post Helpful? 0
  • +
  • -

#44 nicephotog   User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 36
  • Joined: 06-June 20

Re: php sending mail but gmail not receiving.

Posted 11 July 2020 - 11:54 PM

There are a few suspect appearances in the script
You declared a "new PHPMailer" object but do not associate anything more than a boolean by fed to it, it is a wonder anything got an email, too no object PHP syntax calling is present not in any sequence that would occur, mysqli_fetch_array returns a result set or row !
The other "while" loops have a "test section" where a boolean must be extrapolated from the test so its a wonder there isn't an error being returned.
Was This Post Helpful? 0
  • +
  • -

#45 Bobby_Bubbles   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 393
  • Joined: 13-March 18

Re: php sending mail but gmail not receiving.

Posted 13 July 2020 - 04:04 AM

View Postnicephotog, on 11 July 2020 - 11:54 PM, said:

There are a few suspect appearances in the script
You declared a "new PHPMailer" object but do not associate anything more than a boolean by fed to it, it is a wonder anything got an email, too no object PHP syntax calling is present not in any sequence that would occur, mysqli_fetch_array returns a result set or row !
The other "while" loops have a "test section" where a boolean must be extrapolated from the test so its a wonder there isn't an error being returned.


What is the correct method then?
Was This Post Helpful? 0
  • +
  • -

  • (4 Pages)
  • +
  • 1
  • 2
  • 3
  • 4