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 = 'contact@yoursite.com'; 

$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

  • Please explain bit more. – Msquare Apr 24 at 7:59
  • I would like to add some functionality to based upon mail sent response, Is there any posibility to do like that – shivashankar m Apr 24 at 8:01
  • Sent response ?? What you want after sent email ? – Msquare Apr 24 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. – shivashankar m Apr 24 at 8:03
  • Please share your code – Msquare Apr 24 at 8:04
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 = 'contact@yoursite.com'; 

$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 */
}
| improve this answer | |
  • okay, i will try with this and let you know – shivashankar m Apr 24 at 8:33
  • please update me . – Msquare May 2 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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