Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,492
    Plugin Contributions
    88

    Default Contact Us: Failed validation when using an email dropdown list

    Client has configured their email options, setting Set "Contact Us" Email Dropdown List to a simple set of email addresses, e.g.
    When a customer attempts to send a contact-us request, a log is generated:
    Code:
    ERROR: Failed sending email to: "[email protected]" <> with subject: "Website Inquiry from My Online Store" (failed validation)
    The issue's cause resides in /includes/modules/pages/contact_us/header_php.php, around line 50:
    Code:
        // use contact us dropdown if defined
        if (CONTACT_US_LIST !=''){
          $send_to_array=explode("," ,CONTACT_US_LIST);
          preg_match('/\<[^>]+\>/', $send_to_array[$_POST['send_to']], $send_email_array);
          $send_to_email= preg_replace ("/>/", "", $send_email_array[0]);
          $send_to_email= trim(preg_replace("/</", "", $send_to_email));
          $send_to_name = trim(preg_replace('/\<[^*]*/', '', $send_to_array[$_POST['send_to']]));
        } else {  //otherwise default to EMAIL_FROM and store name
        $send_to_email = trim(EMAIL_FROM);
        $send_to_name =  trim(STORE_NAME);
        }
    When the contact-us list is a "simple list of email addresses", the preg_match call results in a 'no-match' condition so that the $send_to_email is blank and the $send_to_name contains the selected email address ... ultimately failing the validation within the zen_mail function.

    This can be corrected via the following changes:
    Code:
        // use contact us dropdown if defined
        if (CONTACT_US_LIST !=''){
    //-bof-20161117-lat9-Correct emails not sent if the contact-us list doesn't "conform" to the email_address <email_name> format
          $send_to_array=explode("," ,CONTACT_US_LIST);
          if (preg_match('/\<[^>]+\>/', $send_to_array[$_POST['send_to']], $send_email_array)) {
            $send_to_email= preg_replace ("/>/", "", $send_email_array[0]);
            $send_to_email= trim(preg_replace("/</", "", $send_to_email));
            $send_to_name = trim(preg_replace('/\<[^*]*/', '', $send_to_array[$_POST['send_to']]));
          } else {
            $send_to_email = trim ($send_to_array[$_POST['send_to']]);
            $send_to_name = trim (STORE_NAME);
          }
    //-eof-20161117-lat9
        } else {  //otherwise default to EMAIL_FROM and store name
        $send_to_email = trim(EMAIL_FROM);
        $send_to_name =  trim(STORE_NAME);
        }

  2. #2
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Contact Us: Failed validation when using an email dropdown list

    Understand though that by using such a "simple" list of email addresses that the email address is then presented for potential spam/collection. By using the suggested/preferred method, only the "name" that is applied is displayed and the actual email address is maintained server side and not shared.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,492
    Plugin Contributions
    88

    Default Re: Contact Us: Failed validation when using an email dropdown list

    mc12345678, that's all well-and-good, but that's not on the client's care-about list; he just wants the contact-us form to work with the data provided.

  4. #4
    Join Date
    Jul 2012
    Posts
    16,733
    Plugin Contributions
    17

    Default Re: Contact Us: Failed validation when using an email dropdown list

    Quote Originally Posted by lat9 View Post
    mc12345678, that's all well-and-good, but that's not on the client's care-about list; he just wants the contact-us form to work with the data provided.
    Also well-and-good, but important for others that wish to duplicate this to understand the potential impact and possibly why it was done the way it was. I suspect that such a conversation was had with the client.

    Besides that, if the addresses are not in some way identifiable as to which to use for what (which without other alterations to the contact us form to directly submit/choose the email address), then seems would have to list the email addresses elsewhere to explain which to use for what. That is something that can be done by using the "two-part" email address process.

    Not so sure that I would call this a bug though, especially when the email address area has the following instruction:

    Set "Contact Us" Email Dropdown List
    On the "Contact Us" Page, set the list of email addresses , in this format: Name 1 <email@address1>, Name 2 <email@address2>
    So following that arrangement the above addresses could be entered as:

    and the "problem" would be solved.

    Otherwise, to finish off this topic should also include updated instruction for that area to something like:

    Code:
    UPDATE configuration SET configuration_description = 'On the "Contact Us" Page, set the list of email addresses , in this format: Name 1 &lt;email@address1&gt;, Name 2 &lt;email@address2&gt; with just an email address: email@address3 or any combination: Name 4 &lt;email@address4&gt;, email@address5' WHERE configuration_key = 'CONTACT_US_LIST';
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. v150 Set "Contact Us" Email Dropdown List
    By f2bs in forum General Questions
    Replies: 4
    Last Post: 29 Apr 2015, 03:25 PM
  2. v150 Set "Contact Us" Email Dropdown List
    By f2bs in forum Basic Configuration
    Replies: 3
    Last Post: 29 Apr 2015, 12:10 AM
  3. Replies: 3
    Last Post: 22 Mar 2011, 10:53 AM
  4. Set "Contact Us" Email Dropdown List setting in admin
    By swguy in forum General Questions
    Replies: 8
    Last Post: 13 Jul 2008, 10:09 AM
  5. [Done 1.3.9] Set "Contact Us" Email Dropdown List
    By capnhairdo in forum Bug Reports
    Replies: 0
    Last Post: 7 Mar 2008, 09:28 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR