Solution:
Never mind. I posted on WP MAIL SMTP support forum but got no response. I figured out that the phpmailer
object is not holding the modified setting inside my plugin. So this is the work-around I implemented just to make things work, though I know this is not the best fix.
I placed the following action in my plugin’s init:
/**
* Reconfigure SMTP setting to make WP MAIL SMTP plugin work
*/
add_action( 'phpmailer_init', 'reconfigure_smtp' );
function reconfigure_smtp( $phpmailer ) {
$SMTPhost = get_option('smtp_host');
$SMTPport = get_option('smtp_port');
$FromEmail = get_option('mail_from');
$FromName = get_option('mail_from_name');
$phpmailer->isSMTP();
$phpmailer->Host =$SMTPhost;
$phpmailer->Port = $SMTPport;
$phpmailer->From = $FromEmail;
$phpmailer->FromName = $FromName;
}
This just fetches the options stored by WP MAIL SMTP and then reconfigures the phpmailer instance. Its just a result of desperate need to fix things ASAP.