0

Can anyone help me how to get the sent email response of shared content.

$name = $_POST['name']; 
$email = $_POST['email']; 
$message = $_POST['message']; 
$from = 'From: yoursite.com'; 
$to = '[email protected]'; 

$subject = 'Customer Inquiry'; 

$body = "From:" .$name."\r\n E-Mail:" .$email."\r\n Message:\r\n" .$message; 

if (isset($_POST['submit'])) 
{ 
    if (mail ($to, $subject, $body, $from)) 
    { 
        echo '<p>Your message has been sent!</p>'; 
    } 
    else 
    { 
        echo '<p>Something went wrong, go back and try again!</p>'; 
    } 
}

i will add email share button on product page, if that product is shared via email, i will give reward points to customer.

Help me great.

Thanks

21
  • Please explain bit more.
    – Msquare
    Commented Apr 24, 2020 at 7:59
  • I would like to add some functionality to based upon mail sent response, Is there any posibility to do like that Commented Apr 24, 2020 at 8:01
  • Sent response ?? What you want after sent email ?
    – Msquare
    Commented Apr 24, 2020 at 8:02
  • i will add email share button on product page, if that product is shared via email, i will give reward points to customer. Commented Apr 24, 2020 at 8:03
  • Please share your code
    – Msquare
    Commented Apr 24, 2020 at 8:04

1 Answer 1

1

Try this way

/* Method -2 we check email is sent or not */

$responce = 0; // for methos-2 email not send

$name = $_POST['name']; 
$email = $_POST['email']; 
$message = $_POST['message']; 
$from = 'From: yoursite.com'; 
$to = '[email protected]'; 

$subject = 'Customer Inquiry'; 

$body = "From:" .$name."\r\n E-Mail:" .$email."\r\n Message:\r\n" .$message; 

if (isset($_POST['submit'])) 
{ 
    if (mail ($to, $subject, $body, $from)) 
    { 
        echo '<p>Your message has been sent!</p>'; 

        $responce = 1; // for method-2 check email send

        /* Method-1  you can add your  reward points to customer code here also */ 
    } 
    else 
    { 
        echo '<p>Something went wrong, go back and try again!</p>'; 
    } 
}


if ($responce == 1) 
{
    /* Method-2  you can add your  reward points to customer code here also */
}
2
  • okay, i will try with this and let you know Commented Apr 24, 2020 at 8:33
  • please update me .
    – Msquare
    Commented May 2, 2020 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.