TNG email not working when running TNG from WordPress

Posts: 70
Joined: Sun Oct 01, 2017 3:08 pm

TNG email not working when running TNG from WordPress

Post by Steve » Sun Sep 23, 2018 3:58 pm

I've used TNG with WordPress for nearly three years. About a month ago 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 program and server updates.

After checking the error logs, I found using TNG inside WordPress created email errors because using the WordPress header loads additional functions. The conflict occurs because TNG and WordPress use the same phpmailer program for SMTP emails. WordPress loads the php and SMTP mail programs from the WordPress folder. When TNG tries to send an email, it loads the same email functions from the TNG folder which causes an error because the functions are already defined by WordPress. 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 changes which phpmailer files are used by tngmaillib.php as shown in the code lines below:


Code: Select all


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 installed inside the WordPress v4.9.8 folder. The code was not tested with TNG and WordPress in separate root folders. However, if the root path points to the WordPress folder, this mod should function correctly.
You do not have the required permissions to view the files attached to this post.