nanodesigns / nanosupport

Create a fully featured Support Center in your WordPress setup without any third party dependency, completely FREE. Get a built-in Knowledgebase too. The plugin is available on WordPress.org repository:
https://wordpress.org/plugins/nanosupport/
GNU General Public License v2.0
50 stars 13 forks source link

does not receive any email notification when ticket created #50

Closed fang-yu closed 5 years ago

fang-yu commented 6 years ago

Actual behavior

Hi: Love nano support!

I currently test plugin in live server, but find some problems. when I created a new ticket with test user, the admin email accoun do not receive any notification email even I have turn it on in the setting page.

but user can receive password reset email.

Thanks!

System Status

WordPress version 4.8.3 NanoSupport version 0.4.1 Active Theme Child Theme for Extra – 1.0 Active Theme Parent Extra – 2.0.84 Debug mode Off Multisite? No Site Language zh_CN Server Apache PHP Memory Limit 1 GB PHP version 5.5.38 MySQL version 5.5.54

Active Plugins:

AddToAny Share Buttons (1.7.21) by AddToAny Akismet Anti-Spam (4.0) by Automattic Bloom (1.2.20) by Elegant Themes Loco Translate (2.0.16) by Tim Whitlock NanoSupport (0.4.1) by nanodesigns SI Captcha Anti-Spam (3.0.3) by fastsecure Ucenter (0.3.5) by ychen User submitted post (20170801) by 杰夫·斯塔尔 Useso take over Google (1.8) by Bruno Xu WordPress Related Posts (3.6.4) by Sovrn, zemanta WordPress import (0.6.3) by wordpressdotorg WordPress Database Backup (2.3.1) by Austin Matzko WP Mail SMTP (0.11.1) by WPForms WP-PageNavi (2.92) by Lester 'GaMerZ' Chan WP Super Cache (1.5.8) by Automattic WP Sync DB (1.5) by Sean Lang WP Sync DB Media Files (1.1.4b1) by Sean Lang WP User Avatar (2.0.8) by flippercode weichat share (1.5.1) by QwqOffice

mayeenulislam commented 6 years ago

Initial suspect: Plugin conflict

With the same configuration with only the suspected plugin WP Mail SMTP we found the same issue. Even it can't send any of the emails when the SMTP plugin is set:

:radio_button: Send all WordPress emails via SMTP.

BTW, if we set the plugin to:

:radio_button: Use the PHP mail() function to send emails. :white_check_mark:

then the server can send both the emails.

The plugin says in its description:

_This plugin reconfigures the wpmail() function to use SMTP instead of mail()...

Somewhere there the problem might persists. I tried:

:radio_button: No: Do not use SMTP authentication. :white_check_mark:

the email sent, but the page was on a loop or something.

Solution at this stage

At this state, with no further information we can't help. But disabling the SMTP plugin can easily solve the issue.

Let's dig it out

For more information, it'd be better if you can provide some more debug information. To do so:

  1. Please, find the SMTP debugging plugin by Kaiser
  2. Make a PHP file in your /plugins directory
  3. Copy code from Kaiser's plugin and paste into your file
  4. From /wp-admin activate the new plugin
  5. Test NanoSupport as you tested before with your SMTP credentials correct in your SMTP plugin

If there's any issue, the debugging plugin should catch. See there for any secret information and strip them out with something so that you stay safe. Then use a service like Pastebin and share the debug information to us.

fang-yu commented 6 years ago

Thanks for your detailed reply! I have installed the plugin, and retest it, but how could I catch the error log with SMTP debugging plugin by Kaiser, I do not see any setting under this plugin.

Try using the WP smtp test function, and get this : https://pastebin.com/bW4rDL3Q

mayeenulislam commented 6 years ago

The SMTP mail returned data won't help us, because that's plain/text email, and triggered from that plugin. To find out our bug we've to trigger our wp_mail() functions.

You first have to activate the WordPress Debug Mode by setting the WP_DEBUG to true in wp-config.php. The plugin displays error only when the debug is active and the user is an administrator.

For error in case of non-admin users, comment out the line 18-19, and 32 till AND. Or, you can use this version (not tested). Then:

  1. Activate the plugin
  2. Submit a new ticket from front end with new user
  3. See if there is any error appeared after the submission of the ticket (when the email triggered)
fang-yu commented 6 years ago

Thanks. turn on the wp-debug mode, and create a new ticket, everything is fine except still getting no error message and no email notification.

btw, I can send test email with smtp plugin.

mayeenulislam commented 6 years ago

Can you please deactivate the SMTP plugin?

And put the following lines (temporarily) on your theme's functions.php:

function mailtrap($phpmailer) {
  $phpmailer->isSMTP();
  $phpmailer->Host = 'smtp.mailtrap.io';
  $phpmailer->SMTPAuth = true;
  $phpmailer->Port = 2525;
  $phpmailer->Username = '0318f3fd47958a';
  $phpmailer->Password = 'bb21bf1cfbe529';
}

add_action('phpmailer_init', 'mailtrap');

It's a mailtrap SMTP test account. Then test a new ticket like earlier. It should pass the 2 emails to the mailtrap account, on creation of new account and submission of new ticket.

fang-yu commented 6 years ago

Hi, I see debug info, it goes like : "Warning: htmlspecialchars_decode() expects parameter 1 to be string, array given in C:\xampp\htdocs\divi\wp-content\plugins\user-submitted-posts\library\core-functions.php on line 220"

mayeenulislam commented 6 years ago

That might not be the issue. BTW to know the suspected plugin's causing the conflict let's deactivate all other plugins than the two on our scope of detection.

I've seen your site, you decorated it nice. BTW using too much plugins is not good for a site's health. Better choose the best some, and stick with 'em. If you are using some plugin that are needed only when you need 'em, deactivate 'em, and activate only when you need 'em.

mayeenulislam commented 6 years ago

smtp-is-working-nanosupport
I checked mailtrap inbox. I received two emails as expected. We can say the SMTP is working and catching emails that are triggered with wp_mail().

Now let's try the same code with your SMTP credo (eg. Gmail or something). Again, deactivate all other plugin, except NanoSupport, and create a new account, and 2 emails should trigger:

  1. To the administrator (notifying about a new ticket)
  2. To the ticket author (notifying about the creation of the account)* (NOT to the Administrator)

* You should have access to the ticket author's email account to check the email inbox

fang-yu commented 6 years ago

Thanks for your help.

I have done the following step, But get no emails in the email box(where the stmp account,admin or ticket author)

BTW, I test it on local machine in xammp

  1. I change the code with:
    
    function mailtrap($phpmailer) {
    $phpmailer->isSMTP();
    $phpmailer->Host = 'smtp.126.com';
    $phpmailer->SMTPAuth = true;
    $phpmailer->Port = 25;
    $phpmailer->Username = 'xxx@126.com';
    $phpmailer->Password = 'xxx';
    }

add_action('phpmailer_init', 'mailtrap');


2. create a new ticket and account in support page(successfully, not error messsage).

And I have question with that in your screenshot, the email was sent to the `0318f3fd47958a` account, but I change to my email account, does it mean that all the notification email will be sent to xxx@126.com instead of admin/ticket author?
mayeenulislam commented 6 years ago

What my understanding of SMTP is:

Instead of using your own PHP mail server, with SMTP, it will use a third party mail server (like Gmail).

But the emails should be sent to the destined people, not to the people whose SMTP credo's used. We're just using his/her credo like a postman - the server is simply delivering on our behalf.

In the case of mailtrap, it's a catcher (debugger), it traps emails passed through its SMTP, so that developers can test.


Now back to the issue: I opened a new ticket with one of our support email, just a moment ago. I got NO new account email from NanoSupport. But I logged out and tried to reset my password on your WordPress site, I got email from your site. That means there might be an issue in NanoSupport with the emailing to the new user using SMTP. But the issue is not clear.

Can we have developer access to your site, so that we can debug the issue on the spot? If you want so, you can create an admin account for support [at] nanodesignsbd [dot] com.

fang-yu commented 6 years ago

Sure,and thanks for your detailed explanation and I have given the support account admin access.

mayeenulislam commented 6 years ago

Can you please email us at support [at] nanodesignsbd [dot] com so that we can have your email and continue this chat there instead of making this issue lengthy.

fang-yu commented 6 years ago

sure, I have sent the email.

fang-yu commented 6 years ago

Update:

I create a brand new site with WordPress in local machine,and add only two plugin (WP Smtp and Nanosupport), and it still does not work.

mayeenulislam commented 6 years ago

There is an issue there, we already suspected, and did so, as you did too. But without generating proper error, we can't dig to the issue, you know.

We will definitely go into this (inshALLAH), but you know, we've other prior issues to work with, and we've limited resource. And there's WP 4.9 is coming... we'll check this thing, not just now, but will inshALLAH...

We're also aware that, a major difference is text/plain and text/html exists in our plugin. We've to have a look there too.

Temporary remedy

If you're not badly in need of using SMTP, then the wp_mail() (PHP Mailer) works great. You can disable the SMTP temporarily until the issue is fixed. 😞

fang-yu commented 6 years ago

@mayeenulislam sure, and I have some debug info may help you:

I disable all the plugins except nanosupport, and turn on the debug mode, get message of

Notice: Trying to get property of non-object in C:\xampp\htdocs\divi\wp-includes\class-wp-query.php on line 3760
Notice: Trying to get property of non-object in C:\xampp\htdocs\divi\wp-includes\class-wp-query.php on line 3762
Notice: Trying to get property of non-object in C:\xampp\htdocs\divi\wp-includes\class-wp-query.php on line 3764"
mayeenulislam commented 6 years ago

It's a separate issue. We noticed this too in many of our installations. But we cannot resolve this first hand as there are Trac tickets pending regarding the issue on WordPress core. It's also in our bug issues in Asana. We've eyes on it. So closing the Notice issue here. 🤓 BTW, thanks for notifying.

mayeenulislam commented 5 years ago

Update

NanoSupport v0.6.0 and upcoming v0.6.1 is found working with WP Mail SMTP (1.4.2) by WPForms. 🥂🎈😃

Screenshot

nanosupport-smtp-working

Observation

The Gmail API configuration in the WP Mail SMTP plugin has been added in version 1.0.0. And Google Mail API integration might also be a matter to get the Gmail SMTP working.

We assume, the configuration of the SMTP plugin (v0.11.1) was conflicting with the Google Mail API and did not work.