Support » Plugins » Hacks » Auto Response with wp_mail

  • Hi everyone,

    (blog URL :

    Based on this code (mail.php)

    Pastebin

    I’m trying to create an auto response email for users who filled my contact form. I added some code as you can see : (everything begining with auto…)

    Pastebin 2

    Thus, I think that something is worng with

    if ( wp_mail( $send_to, $subject, $email_content, $headers, $autoreply, $autosubject, $autoemail_content, $autoheaders ) ) {
    	$response = ( isset( $is_ajax ) ? '1' : esc_attr( __('Message sent! Thank you!', 'haku') ) );

    But I don’t know what.

    Many thanks in advance for help or advises,

    Le Geek

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Yes, there is something wrong with your call to wp_mail(). It takes up to 5 parameters, yet you provide 8. I can’t take time accurately determine what you’re specifically trying to do, so can’t reliably advise in detail. As a guess, try something like wp_mail( $autoreply, $autosubject, $autoemail_content, $autoheaders )

    This invalidates whatever the code was doing previously, you may need additional code to separate out the original function from the auto response function.

    Hey,

    Thanks for you reply.

    Indeed, i’m gonna try what you suggest.
    I think I’ll create an other fonction or mail.php file, will include it in the original one and make o call of the new fonction.

    In any case, if you have more infos, I’ll take them 🙂

    Thanks again ^^

    I did find the solution for my case.

    In fact I had to double call my wp_mail() function by this way :

    if ( wp_mail( $send_to, $subject, $email_content, $headers ) ) {
    wp_mail( $form_contents_email, $autosubject, $autoemail_content, $autoheaders );

    Many thanks again fo opening my eyes on this part of the code :))

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Auto Response with wp_mail’ is closed to new replies.