WordPress.org

Ready to get started?Download WordPress

Forums

Auto Response with wp_mail (4 posts)

  1. Le Geek
    Member
    Posted 1 year ago #

    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

  2. bcworkz
    Member
    Posted 1 year ago #

    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.

  3. Le Geek
    Member
    Posted 1 year ago #

    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 ^^

  4. Le Geek
    Member
    Posted 1 year ago #

    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 :))

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags