rohmann / global-smtp

WordPress Global SMTP
62 stars 27 forks source link

2.1 - Still overwrites GLOBAL_SMTP_FROM and GLOBAL_SMTP_FROM_NAME #8

Closed Surbma closed 9 years ago

Surbma commented 9 years ago

Hi,

I have tested the new version, but it still has the same problem. :(

Here are the original issues: #1 #5

Please take a look at the code to fix this issue! Thank you very much!

rohmann commented 9 years ago

Could you clarify what is happening? I tested the WordPress filters and everything worked as expected for me.

Here's the intended order of preference:

  1. Defining GLOBAL_SMTP_FROM and GLOBAL_SMTP_FROM_NAME will apply those settings globally.
  2. If they are not defined, the WordPress defaults are assumed.
  3. If a plugin hooks into wp_mail_from or wp_mail_from_name those values will always be preferred.

One exception would be if a plugin hooked in very early. I'm hooking in at -999 for both filters. If a plugin specifies an earlier priority, then the constants would be applied instead.

Surbma commented 9 years ago
  1. Defining GLOBAL_SMTP_FROM and GLOBAL_SMTP_FROM_NAME is done.
  2. I'm submitting a form with a name and email.
  3. Form is set to use the name and email values as the sender.
  4. Email is arrived, but the name and email of the sender is inherited from the GLOBAL_SMTP_FROM and GLOBAL_SMTP_FROM_NAME constants.

One exception would be if a plugin hooked in very early...

I don't know, if Gravity Forms is using an early hook. But if you tell me what to test, I will do it and report the results.

rohmann commented 9 years ago

How are you testing this? Could you try using this plugin? https://wordpress.org/plugins/check-email/

Let me know if that let's anything through. If it's not working, you could test for a plugin conflict, you would need to deactivate all your plugins and then reactivate them one at a time sending test emails in between.

Also, was this working for you previously? I recall you mentioned making some modifications. If you have a backup, you could post it as a gist and we could take a look at the differences.

Surbma commented 9 years ago

I'm testing this as described in the previous comment. I'm submitting a form. This form is created with Gravity Forms.

It was working previously with your 2.0 version if I deleted two lines: https://github.com/rohmann/wp-multisite-smtp/issues/1#issuecomment-25770009

rohmann commented 9 years ago

Can you download from master and let me know if that fix is working for you? Gravity Forms sets a From instead of using the filter, so adding the filters didn't make a difference for that use case.

Surbma commented 9 years ago

I have downloaded the latest master version. It is working now as expected. Even I can delete GLOBAL_SMTP_FROM and GLOBAL_SMTP_FROM_NAME and it still works. :)

Thank you very much for your support!

Note: You should update the version number in the file also.

rohmann commented 9 years ago

thanks for confirming! :) Going to bump the version and tag a release