• Resolved dahlskebank

    (@dahlskebank)


    I have activated the “Notify By Email” settings, and these emails are sent to my gmail account. But for some reason these emails are also “sent” by my gmail address. Which gmail registers as spam automatically since gmail knows that they did not send that email…

    How and where can I change this? All other plugins like contact forms and auto-update use “[email protected]”.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    AIOWPSF sends all emails with “From: <admin email>” header and there’s currently no setting to change it. I’ll try to submit a patch, I also consider this a problem – I know about webhosts that only allow to send email from domain of the website.

    Cheers,
    ?eslav

    Thread Starter dahlskebank

    (@dahlskebank)

    Awesome! Thanks! I’m not that good with WordPress coding, but I vaguely remember wordpress@domain being the default email address when WordPress sends emails. Most likely some function that can be used…

    ??

    Actually, this is the default behavior of WP mailer, when no “From” header is set. I checked WP code base and I think that for your particular problem, the best solution is to use core WP filters:

    function fix_wp_mail_from($from_email) {
      if ( $from_email === '[email protected]' ) {
        $from_email = '[email protected]';
      }
      return $from_email;
    }
    add_filter('wp_mail_from', 'fix_wp_mail_from');
    

    This snippet solves the same problem you can have with any other plugin that use your admin email address to send email from.

    Cheers,
    ?eslav

    Optionally, to force WP to always send email as “[email protected]”, just use the following:

    function fix_wp_mail_from() {
        return '[email protected]';
    }
    add_filter('wp_mail_from', 'fix_wp_mail_from', 10, 0);
    

    This is more future proof solution as it keeps working even if you change your admin email address.

    Thread Starter dahlskebank

    (@dahlskebank)

    This snippet solves the same problem you can have with any other plugin that use your admin email address to send email from.

    This is in fact the only plugin where I have this problem…
    But thanks for posting a solution! ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to change email address sent from?’ is closed to new replies.