WordPress.org

Ready to get started?Download WordPress

Forums

Fast Secure Contact Form
[resolved] Feature request: allow using a custom from email address (4 posts)

  1. tomdxw
    Member
    Posted 1 year ago #

    Hi,

    We use this plugin on two or three of our client sites, it works really well.

    But on one of those sites we've had to modify the plugin to set the From address to webmaster@client.com because if an employee of the client uses the contact form it sets the From address to "user@client.com", and the client's incoming email servers reject all emails from @client.com (except webmaster because that's whitelisted) unless the email contains headers authenticating the mail as originating from client.com (to prevent spoofing).

    If it would be possible, just adding the following would really help so that we don't have to modify the plugin every time we update to the latest version (around line 954 in si-contact-form-process.php):

    $this->si_contact_from_name  = apply_filters('si_contact_from_name', $this->si_contact_from_name);
    $this->si_contact_from_email = apply_filters('si_contact_from_email', $this->si_contact_from_email);

    Thanks,
    Tom Adams
    dxw

    http://wordpress.org/plugins/si-contact-form/

  2. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    Yes in the next version

  3. tomdxw
    Member
    Posted 1 year ago #

    Thank you very much!

  4. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    Just a note about version 4.0, it has a 2nd parameter for form number so you can control what forms you want this on.

    Add the following code to your theme's functions.php file or to a custom plugin.
    Be sure to set the setting in the function to control which forms you want this on.
    These filters only work with versions 4.xx and up, not the 3.xx versions or lower.

    function my_action_from_name($from_name, $form_id_num) {
    
    ##################################
     // control which forms you want this on
     $all_forms = false; // set to true for process on all forms, or false to use settings below
     $forms = array('1','2');  // one or more individual forms
     ##################################
     if ( !in_array($form_id_num, $forms) && $all_forms != true)
     return $from_name;
    
      // change the email from_name
      $from_name = 'the name you want';
    
       return $from_name;
    
    }
    // filter hook to change the email from_name
    add_filter('si_contact_from_name', 'my_action_from_name', 1, 2);
    function my_action_from_email($from_email, $form_id_num) {
    
    ##################################
     // control which forms you want this on
     $all_forms = false; // set to true for process on all forms, or false to use settings below
     $forms = array('1','2');  // one or more individual forms
     ##################################
     if ( !in_array($form_id_num, $forms) && $all_forms != true)
     return $from_email;
    
      // change the email from_email
      $from_email = 'the email you want';
    
       return $from_email;
    
    }
    // filter hook to change the email from_email
    add_filter('si_contact_from_email', 'my_action_from_email', 1, 2);

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.