Email Notifications Always Use SITE_NAME As Sender?

Hello,

Using the latest version of Appointments +, I see that Email Notifications are being sent from SITE_NAME.

The following plugin is configured on the site:
Plugin Name: WP-Mail-SMTP
Version: 0.9.5, despite the fact that I have

... and when i send a test message from the plugin, the received test email shows the correct sending same, but when Appointment+ sends its notification emails, the sending name is always the SITE_NAME.

I would like the sending name to be SERVICE_PROVIDER, or in the alternate, the sending name specified by the above plugin.

How can one override this?

Thanks,
JC

  • Vinod Dalvi

    Hi JC,

    I hope you are well today and thank you for your question.

    What are you referring as sending name?
    Are you referring the sending name as the name displayed in the attached screenshot?

    Could you please share the screenshot of it?

    Also would you mind if I logged in to your site and did some troubleshooting? This might help get to the bottom of this faster. If this is ok, just grant me temporary admin access to your site by clicking "Grant Access" button in the WPMU DEV Dashboard Settings as described on the following page and reply on this thread after granting it?

    https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/

    Kind Regards,
    Vinod Dalvi

  • Vinod Dalvi

    Hi Jean-Claude,

    Thank you for your reply.

    In your shared screenshot is the text "BHCS Local Dev Server" your site name?

    Could you please share the expanded screenshot of the email by viewing it as i have shared the screenshot?

    As you can see in my shared screenshot that it's working fine for me so i think this can be due to plugin/theme conflict on your site specially the SMTP plugin.

    You can just try on your development site temporary using default WordPress theme like Twenty Fifteen and temporary deactivating all other plugins as displayed in the following flowchart to know which theme/plugin is conflicting if any.

    https://premium.wpmudev.org/manuals/getting-support/

    Also please grant the support staff access so that i can troubleshoot it.

    Kind Regards,
    Vinod Dalvi

  • Jean-Claude

    Hi Vinod,

    Thanks much for assistance.

    I went ahead and added the wp-config.php switch as suggested, and then did another test transaction, but that didn't fix the issue. I then went ahead and installed your quick-plugin and tested again, and that indeed addresses the issue.

    Disabling your custom filter, and testing further, it appears that the FROM NAME and FROM EMAIL ADDRESS fields in the received Appointment + email notifications are being set and/or overridden by our site's Site Title and E-mail Address settings found under the Admin>Settings>General Settings.

    Thanks again for your assistance.

    Jean-Claude

  • Jean-Claude

    Hi Vinod,

    As I've confirmed, Appointment+ email notifications is setting the <FROM NAME> and <REPLY TO> email fields from the site's general <Site Title> and <E-Mail Address> fields respectively, which are found and set under the site's Settings>General pane.

    And as further confirmed, the only plugin installed on our site that involves anything having to do with setting these values is the installed WP-Mail-SMTP plugin, which I have confirmed is working correctly. If I change the site's <Site Title> and <E-Mail Address> fields, then this also alters the <FROM NAME> and <REPLY TO> email address used by the Appointments + email notifications.

    The issue therefore doesn't appear to be caused by a theme/plugin conflict, but rather that Appointments+ is using the <Site Title> and <E-Mail Address> settings found directly under the site's main Settings>General settings and not those set by the WP-Mail-SMTP plugin.

    So given that this is the case, and given that your quick fix plugin hard-codes the issue, then one can therefore only conclude that the issue is NOT being caused by some installed theme/plugin conflict, but rather by the fact that Appointments+ has no provision for setting these values directly and that Appointments+ uses the WP site's general <Site Title> and <E-Mail Address> fields to set its <FROM_NAME> and <REPLY-TO> email fields in its email notification messages, and not the field values set by the WP-Mail-SMTP plugin, whose job it is to set these values.

    In conclusion, one shouldn't have to change their site's title to resolve this issue.

    Thanks,
    Jean-Claude

  • Jean-Claude

    Hi Vinod,

    Enclosed below is the .php code from Appointments+ which appears to be responsible for generating the email notification message headers. This confirms that Appointments+ obtains the <FROM_NAME> and <REPLY TO> fields from the $blogname and $admin_email variables. This issue is therefore NOT caused by a theme/plugin conflict. The A+ plugin by default appears to set the <FROM_NAME> in the message header to the name of the site, and the <REPLY TO> email address to the name of the site admin. Both of these fields are therefore directly derived from the values set under the blog Settings>General settings.

    The A+ plugin should have a way to permit the <REPLY TO> email address sent in email notifications to be set to Service Provider 's email address instead of the system admin email address, and the <FROM_NAME> with the Service Providers name.

    Thanks ,
    Jean-Claude

    //----------------------------------------------------------
    function message_headers () {
    $admin_email = $this->get_admin_email();
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    $content_type = apply_filters('app-emails-content_type', 'text/plain');
    if (!(defined('APP_EMAIL_DROP_LEGACY_HEADERS') && APP_EMAIL_DROP_LEGACY_HEADERS)) {
    $message_headers = "MIME-Version: 1.0\n" . "From: {$blogname}" . " <{$admin_email}>\n" . "Content-Type: {$content_type}; charset=\"" . get_option('blog_charset') . "\"\n";
    } else {
    $message_headers = "MIME-Version: 1.0\n" .
    "Content-Type: {$content_type}; charset=\"" . get_option('blog_charset') . "\"\n"
    ;
    add_filter('wp_mail_from', create_function('', "return '{$admin_email}';"));
    add_filter('wp_mail_from_name', create_function('', "return '{$blogname}';"));
    }
    // Modify message headers
    $message_headers = apply_filters( 'app_message_headers', $message_headers );

    return $message_headers;
    }

  • Vinod Dalvi

    Hi Jean-Claude,

    Thank you for your detailed reply.

    As i have said previously that it's working fine on my test site as shown in the shared screenshot so it doesn't seem the plugin issue.

    Please see the following chunk of code in your shared code that the Appointments+ provides provision to decide whether the blogname should be added in the from name or any custom one using the filter wp_mail_from_name which our quick fix plugin uses so it's not hard coding it.

    if (!(defined('APP_EMAIL_DROP_LEGACY_HEADERS') && APP_EMAIL_DROP_LEGACY_HEADERS)) {
    $message_headers = "MIME-Version: 1.0\n" . "From: {$blogname}" . " <{$admin_email}>\n" . "Content-Type: {$content_type}; charset=\"" . get_option('blog_charset') . "\"\n";
    } else {
    $message_headers = "MIME-Version: 1.0\n" .
    "Content-Type: {$content_type}; charset=\"" . get_option('blog_charset') . "\"\n"
    ;
    add_filter('wp_mail_from', create_function('', "return '{$admin_email}';"));
    add_filter('wp_mail_from_name', create_function('', "return '{$blogname}';"));
    }

    According to the above code if you add the following code in the wp-config.php file of your WordPress install then it should skip the blogname from the From header so please try using it.

    define( 'APP_EMAIL_DROP_LEGACY_HEADERS', true );

    I think we mistakenly set the above constant to false previously so setting it to true will work for you.

    Regards,
    Vinod Dalvi

  • Jean-Claude

    Hi Vinod,

    Thanks for your assistance.

    As requested, I added to wp-config.php file of our WP install.:

    define( 'APP_EMAIL_DROP_LEGACY_HEADERS', true );

    Regardless of whether this flag is set to TRUE or FALSE, setting this flag makes no difference on our system. The only thing that works is to use your custom filter to override <wp_mail_from_name> to the value set by your filter.

    So in conclusion as coded and regardless of how APP_EMAIL_DROP_LEGACY_HEADERS is set, A+ always sets FROM_NAME to $blogname and REPLY TO to $admin_email, unless wp_mail_from_name is overridden with the value set by your custom filter.

    Thanks,
    JC

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.