Support » Plugins » [Plugin: Contact Form 7] Pipes "|" for selectable email recipient doesn't work

  • Hi there,

    I’m using Contact Form 7 for my Website contact form, and I have a required select (select*) dropdown to ask users to select the kind of their questions. In the dropdowm, I set a different email address for each kind of question using pipes “|” (, so the email gets sent to the certain email address based on the kind of user’s question.

    Here’s what I have:

    <p class="dp">
       [select* question-cat include_blank "Career opportunities|" "New business opportunities|" "Existing clients|" "General question|"]

    And in Mail setting, in To field I have:

    The code above was working fine when I first developed the site a few months ago, but it suddenly stopped working recently:

    1). It does not pick up the email addresses after the “|” symbol, so [question-cat] is empty, which gives me (or the users) an error saying “Failed to send your message” with a red border around it when attempting to submit the form, and no email gets sent.

    2). The form validation on this select seems to be messed up – I set this dropdown “required” (select*), and it gives a validation error even though you choose one of the options.

    For the problem 1), I found out that if I don’t use “|”, the form works fine perfectly (the problem 2) still occurs), so I believe it’s something to do with how I set up “|” for selectable email recipient. And most importantly both problem 1) and 2) occur only in Chrome and Safari – it all works fine in Firefox.

    I also noticed that even though you get the “failed” error when submit the form due to the problem 1), the information (except for [question-cat]) still does get sent to the database if I check it using Contact Form DB extension.

    I use the latest version of WordPress: 3.5.1
    and just updated Contact Form 7 to 3.4 from 3.3.3.
    Also, I use Select Box jQuery Plugin for select field replacement.

    Thanks a bunch in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • It stopped working for me too a week ago when i updated their plugin.
    Luckily i had a back up of the previous version
    So i reverted to that one and its now working again. Hopefully they work this out

    You need to fix this plugin until official patch/version comes out.

    1) In file /includes/pipe.php add this below function collect_befores

    function collect_afters() {
    		$afters = array();
    		foreach ( $this->pipes as $pipe ) {
    			$afters[] = $pipe->after;
    		return $afters;

    2) in file /includes/shortcodes.php around line 122 replace whole block to look like this

    if ( WPCF7_USE_PIPE ) {
        $pipes = new WPCF7_Pipes( $scanned_tag['raw_values'] );
        $scanned_tag['values'] = $pipes->collect_befores();
        $scanned_tag['pipes'] = $pipes;
        $scanned_tag['labels'] = $pipes->collect_afters();
    } else {
        $scanned_tag['values'] = $scanned_tag['raw_values'];
        $scanned_tag['labels'] = $scanned_tag['values']; // <-- this was below if block, delete it there

    I’m having the exact same problem. I tried ppavlovic’s fix but got an error message. I must have done something wrong 🙁

    Found the solution to my problem. I removed the spaces before and after pipes and form works perfectly again.

    I solved the same problem in a simpler way:

    In /modules/select.php, inside wpcf7_select_shortcode_handler function,
    after $name = $tag->name:

    `if(isset($tag->pipes->pipes) && !empty($tag->pipes->pipes)) {
    foreach($tag->pipes->pipes AS $ln=>$array) {
    $labels[$ln] = $array->before;
    $values[$ln] = $array->after;
    else {
    $values = $tag->values;
    $labels = $tag->labels;

    Where exactly did you copy that block? I have:

    if ( $matches = $tag->get_first_match_option( '/^default:([0-9_]+)$/' ) )
    		$defaults = explode( '_', $matches[1] );
    	$multiple = $tag->has_option( 'multiple' );
    	$include_blank = $tag->has_option( 'include_blank' );
    	$first_as_label = $tag->has_option( 'first_as_label' );
    	$name = $tag->name;
    	$values = $tag->values;
    	$labels = $tag->labels;
    	$empty_select = empty( $values );

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Contact Form 7] Pipes "|" for selectable email recipient doesn't work’ is closed to new replies.