• GJS

    (@gojobsearch)


    Good evening

    I have changed the default email going out to new users when they register etc in my functions.php file using:

    // Function to change email address
    function wpb_sender_email( $original_email_address ) {
        return 'MYCOMPANYNAME@MYCOMPANY.CO>UK';
    }
    // Function to change sender name
    function wpb_sender_name( $original_email_from ) {
        return 'MYCOMPANYNAME';
    }
    // Hooking up our functions to WordPress filters 
    add_filter( 'wp_mail_from', 'wpb_sender_email' );
    add_filter( 'wp_mail_from_name', 'wpb_sender_name' );

    That works great. The problem I am having is one of the plugins we use has set a default email address to come from candidates when they register for a job and get sent to the employer. So they all need to be unique. This works when my default email is coming from ‘WordPress’. However it does not work when I change my default email address. This seems to obviously overwrite any other sending email addresses.

    I do not want my emails going out to clients coming from WordPress. It seems crazy this cannot be set to whatever you want in your dashboard. So how can I change it to come from my company without it overriding any other plugins on the site who need to have their own email addresses to send from etc?

    I have tried a couple of plugins with the same result.

    Thanks
    D

Viewing 3 replies - 1 through 3 (of 3 total)
  • Wrap your functions in a if statement that determines what form is submitting the request

    Thread Starter GJS

    (@gojobsearch)

    Hi

    Thank you for getting back to me.

    Unfortunately I do not know how to do that. I have to search to find the code to change the WordPress email to my personalized email.

    Could you possibly assist with this please? So that my emails are personal but don’t overwrite plugins which have this setup differently.

    Many thanks
    D

    Hello,

    The function you used is actually overriding everything when WordPress tries to send an e-mail.

    Now most contact form plugins allow you to modify the ‘FROM’ e-mail so you can input there whatever mail you wish to show.

    After searching online a bit as I found this interesting the function you used will most likely replace that FROM field everywhere as well ( so we end up at your situation ).

    I’ve read that some users used -> https://wordpress.org/plugins/personal-email/ instead of the custom function you entered to alter the default e-mail and that was not affecting any contact form plugin.

    Be aware I haven’t tested it myself so make sure to keep backups etc to be safe, but I guess it is worth a try if it’s easier through a plugin for you instead of fiddling through custom codes.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Changing Sending Email’ is closed to new replies.