Having issues sending to GMAIL email addresses. We have a test PHP script that tries to send an email (really basic... a text subject and a text line for the body) to 3 email recipients... one actually the sending email (not GMAIL) and the other 2 are both GMAIL. This has been failing for over a week of trial an error, tech support calls, talking to GMAIL, setting up Google Postoffice.... to no avail.
The only thing we haven't done, and are not 100% familiar with is setting up DKIM. It is referenced in a couple places on the PHPMAILER.PRO website but still a bit lost. We have a DKIM key created at the domain as needed and copied it into a file on our hosting site.
The problem is, the documentation for PHPMAILER.PRO and using DKIM has not been updated with new naming convention and there is possibly usage or an error in PHPMAILER.PRO 1.3 code.
Here is the page we stumbled upon on the PHPMAIL.PRO website (through a link on a Google search...)
https://phpmailer.pro/index.php?pg=dkim
It references.... adding 4 lines of code (which is actually 5)...
$mail->DKIM_domain = ‘yourdomain.com’;
$mail->DKIM_private = dirname(__FILE__).’/.htkeyprivate_noencoding’; // protect from public access
$mail->DKIM_selector = ‘PHPMailer Pro’; // can be any alpha-numeric string (this is the default for PHPMailer Pro)
$mail->DKIM_passphrase = ‘1234567890’; // can be any string (PHPMailer Pro uses the time() function to generate 10 digits)
$mail->DKIM_identity = ’yourname@yourdomain.com’; // optional, but you are limiting your possibility of success without it
Those don't seem to work... come back DEPRECIATED. I believe, looking through the actual PHPMAILER.PRO code that it should be....
$mail->dkimDomain
$mail->dkimPrivate
$mail->dkimSelector
$mail->dkimPassphrase
$mail->dkimIdentity
I tried setting those in our test script (sending to 2 GMAIL addresses) and there was an error generated, BUT, for the first time in a week, the script was actually able to "send" an email to GMAIL and we were able to see it. Thats progress.
The NEW problem is that that message is not formatted correctly. There is no subject, the actual readable message has alot of the actual email source header information, and no formatting other than the source header.
The ERROR we saw when running the script says...
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in ourDomain/PHPMailer.Pro.php on line 994
I am thinking this all has to do with something not being setup correctly on our end for DKIM and using PHPMailer.pro... but not sure where to go with this.
Any help would be greatly appreciated... this is a time sensitive issue, need to get some event notification emails out and over 130 GMAIL subscribers aren't getting the info.
Pete Brama
Additional follow up after many many hours of going through code on our end and PHPMAILER-PRO...
Originally thought that there was a "syntax" error somewhere in the email header/body/dkim creation. Done tons of trial and error and compares. Can't find anything "odd" from what I can see comparing it with know working emails WITH other DKIM-Signatures.
The attached JPG shows the actual email source code with the DKIM line added. Everything from the "blank line" below the DKIM shows up as the messages body... just as listed in this file. In reality, only the "This is a test message via hostgator to a GMAIL account" should be the body, nothing else.
Hope this helps....