TNG Email not working with WordPress

Post Reply
steven
Posts: 133
Joined: Sun Oct 01, 2017 3:08 pm

TNG Email not working with WordPress

Post by steven »

WordPress version 5.6 and newer uses different file names for the SMTP mailer files. DO NOT use the mod below if you are running WordPress version 5.5 or newer. Since the WordPress mailer file names are different from TNG's, the mod is no longer needed. If you install the mod anyway TNG will not be able to send emails because it will try to load a depreciated WP file resulting in an error.
 

I've used TNG with WordPress since late 2015. Suddenly I stopped getting new user registration notices and approved users did not receive a confirmation email. The WordPress contact us email page was working but the TNG email and contact us page was not. The only changes were some program and server updates.

After checking the error logs, I found using TNG inside WordPress created email errors because TNG and WordPress use the same phpmailer program for SMTP emails. WordPress loads the php and SMTP mail programs from the WordPress folder. Then when TNG tries to send an email, it attempts to load the same email functions from different files in the TNG folder which causes the error. I have not determined why everything worked previously and then suddenly stopped.

WordPress updates automatically so instead of changing WordPress, I created a mod that lets TNG use the WordPress phpmailer files. To use this mod SMTP authentication must enabled in TNG: Setup >> Configuration >> General Settings >> Site Design and Definition.

Keep in mind this mod may not work with all TNG/WordPress configurations. If the mod does not resolve the email problem, first uninstall then delete the mod.

THIS MOD WORKS WITH WORDPRESS 5.5 and OLDER. DO NOT USE WITH NEWER VERSIONS OF WORDPRESS.
WordPress-TNG email_V12.0.0.0.zip
(519 Bytes) Downloaded 963 times
9/23/18


This mod changes which phpmailer files are used by tngmaillib.php as shown in the code lines below:

ORIGINAL TNG CODE:

Code: Select all

require_once("class.phpmailer.php");
require_once("class.smtp.php");
MODIFIED CODE:

Code: Select all

require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/class-phpmailer.php' );
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/class-smtp.php' );
This mod was tested with TNG v12.0.1 through v12.3 and WordPress from v4.9.8 through v5.4 with TNG installed inside the WordPress folder. The code was not tested with TNG and WordPress in separate root folders. However, if the domain root path points to the WordPress folder, the mod should function correctly.
 
Last edited by steven on Sat Sep 04, 2021 12:11 pm, edited 1 time in total.
Reason: Do not use with WordPress 5.6 and above


Last bumped by steven on Tue Jul 30, 2019 10:30 pm.
Post Reply