Viewing 1 replies (of 1 total)
  • The fix to send multiple invitations

    Following is the simple fix, Just putting the wp_mail at the right place ??

    sendmail.php

    Simply put the following code instead of the one there.

    <?php
    add_action( ‘wp_ajax_invfr_process_ajax’, ‘invfr_sendmail’);
    add_action( ‘wp_ajax_nopriv_invfr_process_ajax’, ‘invfr_sendmail’);
    function invfr_sendmail() {
    $post = ( !empty( $_POST ) ) ? true : false;

    if( $post ) {
    $subject = invfr_get_settings( ‘subject’ );
    $message = invfr_get_settings( ‘message’ );
    $friends = $_POST[‘friend_email’];
    $errors = array();

    foreach ( $friends as $key => $friend ) {
    $name = stripslashes( $_POST[‘friend_name’][$key] );
    $email = trim( $_POST[‘friend_email’][$key] );

    // Check name
    if( !$name )
    $errors[] = ‘#friend_name-‘ . $key;

    if( !$email )
    $errors[] = ‘#friend_email-‘ . $key;

    if( $email && !is_email( $email ) )
    $errors[] = ‘#friend_email-‘ . $key;

    $mail = wp_mail( $email, invfr_tokens_replacement( $subject, $_POST, $key ), invfr_tokens_replacement( $message, $_POST, $key ) );
    }

    //send email
    if( !$errors )
    {
    if( $mail )
    echo ‘sent’;
    }
    else
    echo json_encode( $errors );

    }
    }
    ?>

    My deepest appreciation to the developer of this plugin.
    Mohamed

Viewing 1 replies (of 1 total)
  • The topic ‘Only sending to last e-mail entered.’ is closed to new replies.