0

So I have this form on a lead capture funnel. Basically what it is supposed to do is send the captured information to the email address in the settings page of the site.(THis is on a wordpress site.)

It used to work fine. Right now though, only the first mail is being sent. the second mail is not being sent. I need to change the subject of the mail in order for it to be read by a third party program. A client has a program that sends an auto response depnding on the subject line so the subject line needs to be the address. So what I did was instead of "get_field('email_subject',13)" i put "$_POST['fab_address']" so that the subject would be the address captured from the form by the user. That worked. I do not know what is the issue with the second mail not sending properly. Also, I do not know what the ",13" is in the "get_field('email_address',13)" and the "get_field('email_subject',13)"

Ultimately I would like the mail to be received by multiple recipients.

Another thing that needs to be accomplished is that the first mail needs to "come from the email associated with the account" What I mean by this. I have an account with third party provider. I have an email associated with that account. By sending an email from the email associated with my account with xyz subject line an auto response is generated. So the form that sends the mail to the third party provider needs to make the message appear to come from the email address associated with the account there.

Wow sorry this got very long winded quite quickly. Thank you for any and all responses that I receive with this issue that I am having.

session_start();

register_nav_menu( 'primary', __( 'Navigation Menu', 'mjc' ) );

function Front_Page_Form()

{

    if(isset($_POST['fab_address'],$_POST['fab_unit'])&&!empty($_POST['fab_address']))

    {

        $_SESSION['address'] = $_POST['fab_address'];

        $message = "Address : $_POST[fab_address] \r\n Unit  : $_POST[fab_unit]  ";

                $headers    =    "From: ".get_field('email_address',13);



        mail(get_field('email_address',13),get_field('email_subject',13).' Address Selected',$message,$headers);

        echo '<script>window.location="/verify/"</script>';

    }

}



function Verify_Form()

{



    if(isset($_POST['ptype'],$_POST['bedrooms'],$_POST['bath'],$_POST['sqft'],$_POST['condition'],$_POST['first'],$_POST['last'],$_POST['email'],$_POST['phone'],$_POST['interested']))

    {

        extract($_POST);

        echo  "<style>.pop-up-form,.popup-overlay{display:block;}</style>";

        if(isset($_SESSION['address'])&&!empty($_SESSION['address']))

        {

            if(!empty($first)&&!empty($last)&&!empty($email)&&!empty($phone)&&!empty($interested))

            {

                if(filter_var($email, FILTER_VALIDATE_EMAIL))

                {

                    $message = "Address : $_SESSION[address] \r\n Property Type  : $ptype \r\n Bedrooms  : $bedrooms \r\n Bathrooms : $bath \r\n Sqft : $sqft \r\n Condition   : $condition \r\n First name  : $first \r\n Last Name : $last \r\n Email : $email \r\n Phone   : $phone \r\n Interested In   : $interested ";

                        $headers    =    "From: ".$email;



                    if(mail(get_field('email_address',13),get_field('email_subject',13),$message,$headers))

                    {



                        echo "<span class='success'>Mail Sent Successfully.</span><br />";

                                                    echo '<script>window.location="http://joecorwin.com"</script>';

                    }else

                    {

                        echo "<span class='error'>Error!! Failed to send mail.</span><br />";

                    }

                }else

                {

                    echo "<span class='error'>Error!! Invalid Email.</span><br />";

                }

            }else

            {

                echo "<span class='error'>You left some mandatory fields empty.</span><br />";

            }

        }else

        {

            echo "<span class='error'>Go to the home page and select the address first.</span><br />";

        }

    }

}

0 Answers0