• Similar to issues reported regarding BCC and CC fields, emails sent via WP SendGrid don’t get the reply-to header attached to them correctly. It would be great to have this worked directly into the plugin, but I was able to fix the problem using the following filter. Posting it here in case others find it useful.

    add_filter( 'wp_sendgrid_args', 'my_append_reply_to_filter', 10, 6 );
    function my_append_reply_to_filter( $args, $to, $subject, $message, $headers, $attachment_array ) {
      // The WP SendGrid plugin doesn't send the replyto argument to SendGrid
      // like it should, so we have to append it
      // SendGrid API: https://sendgrid.com/docs/API_Reference/Web_API/mail.html
      // $args is sent to SendGrid in the request
    
      if ( !empty( $args[ 'replyto' ] ) )
        return $args;
    
      $reply_to = !empty( $headers[ 'reply-to' ] ) ? $headers[ 'reply-to' ] : '';
      $reply_to = !$reply_to && !empty( $headers[ 'Reply-To' ] ) ? $headers[ 'Reply-To' ] : $reply_to;
      $reply_to = !$reply_to && !empty( $headers[ 'REPLY-TO' ] ) ? $headers[ 'REPLY-TO' ] : $reply_to;
    
      if ( $reply_to )
        $args[ 'replyto' ] = $reply_to;
    
      return $args;
    
    }

    https://www.ads-software.com/plugins/wp-sendgrid/

  • The topic ‘Reply-to header not being sent correctly – FIX’ is closed to new replies.