How To Add Additional Emails To The Contact Form

resolved (17 posts) (6 voices)

  1. boris5000
    Member

    Hi,
    My client wants the message from the contact form to be sent to 3 different recipients. What would be the easiest way to do that?
    Thank you.

    Posted 2 years ago #
  2. Elliott
    Support

    Hello boris5000,

    You should be able to separate the emails with commas,

    "email1@domain.com,email2@domain.com,email3@domain.com"

    Posted 2 years ago #
  3. boris5000
    Member

    I tried using your syntax but I believe there is a problem with scripting. Here is why.
    1. If I list only one email and it is not used as admin email mail delivery works
    2. If I list multiple emails and one of them is used as admin email, it only delivers to the admin email
    3. If I list multiple emails and none of them is used as admin email, it still only delivers email to the admin's email address and no one else.

    I checked all the trash boxes, etc no emails were sent. Can you please look into this? Thank you

    Posted 2 years ago #
  4. Elliott
    Support

    We use the WP_Mail function for sending email, http://codex.wordpress.org/Function_Reference/wp_mail, and in the documentation it states that you can separate multiple addresses by commas.

    Paste the code your using here.

    Posted 2 years ago #
  5. boris5000
    Member

    Ok, I have added your support email to the form, may be you can check by sending an email to yourself.

    Here is the page URL http://oemcable-connective.com/contact-request-for-quotation/ There are two contact forms using the same email address sets.

    And here is the code I am using:

    ===================
    [one_half]
    [colored_box bgColor="#ffffff" textColor="#000000"]
    Request For Quotation

    Before pressing "SUBMIT REQUEST" button please solve the math captcha. Thank you.
    [contactform email="boris.benz@gmail.com,boris@borisbenz.com,supportteam@mysitemyway.com" subject="RFQ Connective LLC" success="Thank you for your request, we will respond shortly" captcha="true"]
    [name label="Name" required="true"]
    [name label="Last Name" required="true"]
    [name label="Company" required="true"]
    [textfield label="Phone" required="true"]
    [textfield label="Cable Type" required="true"]
    [textfield label="Quantity" required="true"]
    [textarea label="Message" required="true"]
    [submit value="Submit Request"]
    [/contactform][/colored_box]
    [/one_half]
    [one_half_last]
    [colored_box bgColor="#ffffff" textColor="#000000"]
    Contact Us With Your Questions

    Before pressing "SEND" button please solve the math captcha. Thank you.
    [contactform email="boris.benz@gmail.com,boris@borisbenz.com,supportteam@mysitemyway.com" subject="Connective LLC Contact" success="Thank you for contacting Connective LLC. We will respond to you shortly" captcha="true"]
    [name label="Name" required="true"]
    [email label="Email" required="true"]
    [textfield label="Phone"]
    [textarea label="Message" required="true"]
    [submit value="Send"]
    [/contactform][/colored_box]
    [/one_half_last]

    Posted 2 years ago #
  6. Elliott
    Support

    Try opening up /wp-content/themes/[your_theme]/lib/classes/contact.php and change line 240 from this,

    if ( @wp_mail( self::$posted_data['mysite_email'], $subject, $msg, $headers ) )

    To this,

    if ( @wp_mail( 'boris.benz@gmail.com,boris@borisbenz.com', $subject, $msg, $headers ) )

    And send an email to see what happens.

    Posted 2 years ago #
  7. boris5000
    Member

    Yeah, this fix worked (hardcoding, usually does the trick but has its limitations). This is not the best solution because in this particular example one form (RFQ) should be submitted to one set of emails and another (Contact) to a different set.

    When you said that custom contact form worked for other users, did you mean that there is actually someone who is managing to use different forms on their website sending emails to different multiple recipients?
    I am not a php wizard as you probably have gathered but "mysite_email' is probably picks only a single email specified as admin's email or the one in the email form. I don't see anywhere an array of additional emails included. Am I wrong?

    Posted 2 years ago #
  8. Elliott
    Support

    Perhaps it was an older version which it was working in. Try changing line 41 in /wp-content/themes/[your_theme]/lib/shortcodes/16-contact.php from this,

    $form_inputs['mysite_email'] = ( is_email( trim( $email ) ) ) ? trim( $email ) : get_option('admin_email');

    To this,

    $form_inputs['mysite_email'] = trim($email);

    Posted 2 years ago #
  9. boris5000
    Member

    Excellent!
    Thank you Elliott, great help.

    Posted 2 years ago #
  10. I need to add multiple emails too, although I'm using Awake 1.3 - can you please show the path to find - 16-contact.php ?

    Posted 2 years ago #
  11. Elliott
    Support

    For the old version I think it should be in /lib/functions/contact.php, but the code is quite different. You'll want to update to the latest versions.

    Posted 2 years ago #
  12. omg
    Member

    Do I need to do this part of the instructions from above:

    Try opening up /wp-content/themes/[your_theme]/lib/classes/contact.php and change line 240 from this,
    if ( @wp_mail( self::$posted_data['mysite_email'], $subject, $msg, $headers ) )
    To this,
    if ( @wp_mail( 'boris.benz@gmail.com,boris@borisbenz.com', $subject, $msg, $headers ) )

    ........ OR CAN I JUST DO THIS:

    Perhaps it was an older version which it was working in. Try changing line 41 in /wp-content/themes/[your_theme]/lib/shortcodes/16-contact.php from this,
    $form_inputs['mysite_email'] = ( is_email( trim( $email ) ) ) ? trim( $email ) : get_option('admin_email');
    To this,
    $form_inputs['mysite_email'] = trim($email);

    -- THANKS

    Posted 1 year ago #
  13. mmswan
    Member

    Yikes! I performed the line 240 task and when i went to check email I got an error message. Then when I changed it back, the site returned. ???

    does this address the contact widget too?

    Posted 1 year ago #
  14. Elliott
    Support

    No, just the shortcode. You can use the shortcode in a text widget if you want it to display in a widget.

    Posted 1 year ago #
  15. targamedia
    Member

    I realize this string is a year old, but I discovered today that a month's worth of leads have been lost because the comma-separated syntax was not working. The instructions above refer to an older version of the themes. I'm using v.3.1 of Echelon.

    Per Boris5000's discovery, this still holds true, and it's astonishing that this issue isn't resolved:
    2. If I list multiple emails and one of them is used as admin email, it only delivers to the admin email
    3. If I list multiple emails and none of them is used as admin email, it still only delivers email to the admin's email address and no one else.

    Posted 6 months ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme