wpsharks / comment-mail

A WordPress plugin enabling email subscriptions for comments.
http://comment-mail.com
GNU General Public License v3.0
8 stars 3 forks source link

Feature Request: Send Test Email for Current Email Template Configuration #213

Open kristineds opened 8 years ago

kristineds commented 8 years ago

Customer wrote..

I was missing a simple button or a field with "enter email to send test email with current template configuration You do have a "test email" field in the Plugin options page. I think the same kind of "test email" input could be on the Template Settings page.

Comment Mail currently has a "Test Mail settings" field under "Email Message Headers" options. It would be nice to have this option added under Email Template settings to be able to send test emails with the current email template configuration.


Mentioned here (private ticket): https://websharks.zendesk.com/agent/tickets/10684

raamdev commented 8 years ago

:+1:

jaswrks commented 8 years ago

:+1:

kristineds commented 8 years ago

@raamdev @jaswsinc Could you point me in the right direction on how I can add this feature? Should I be creating a new function? Or use the existing one? I'm looking at this: https://github.com/websharks/comment-mail-pro/blob/433c3acb15bd3d35ec710c6ce13535f2a7dedb86/src/includes/classes/MenuPageActions.php#L92

jaswrks commented 8 years ago

@kristineds The block of code in saveOptions() that you referenced contains this block which deals with mail tests; i.e., if certain POST variables are set—those that would request that a test email be sent, those routines handle sending a test email.

However, those tests that are performed are specifically designed to help test SMTP connectivity in general; e.g., whenever you change the SMTP or other mail settings you can click a button that will run those tests. The test emails themselves only contain just a quick plain-text message to indicate the test worked, they do not contain any sort of comment notifications that would showcase changes that you made to the templates.

So in order to add this functionality you would need to create brand new methods that would be capable of the following, as I see it:



One problem with this technique is that any WordPress plugins running on a given site (i.e., those that hook into Post creation or Comment creation) might respond to a new Post being created (or to a new Comment being created, and they might run also whenever you run this test with what is nothing more than a fake scenario. So that's something to keep in mind. I haven't given this a ton of thought yet.

raamdev commented 8 years ago

One problem with this technique is that any WordPress plugins running on a given site (i.e., those that hook into Post creation or Comment creation) might respond to a new Post being created (or to a new Comment being created, and they might run also whenever you run this test with what is nothing more than a fake scenario.

That was my thought exactly when I saw you mention programmatically creating a post for this. I don't think that's a good idea. There's way too much room for error there (e.g., a site could have thousands of subscribers and the site might have a plugin installed that automatically announces newly published posts to all its subscribers--the dummy post might get sent to thousands of people!).

A better approach, IMO, would be to have the user supply a URL to a published post that contains comments. It could be a dummy post that they create, or it could be a real post with real comments. The whole idea here is to allow a site owner to see what the email will look like for subscribers. (We just need to make sure that we're not inadvertently triggering notifications to existing subscribers when a site owner supplies a URL to a real post, with real comments and real subscribers.)