Hello,

I have a PHP email script that works I just can't figure out adding the unsubscribe link and tracking.

<?php
$formMessage = "";
$senderName = "";
$senderEmail = "";
$senderMessage = "";
if (isset($_POST['cusername']))
{

 
    // Gather the posted form variables into local PHP variables
    $senderName = $_POST['cusername'];
    $senderEmail = $_POST['cemail'];
    $senderMessage = $_POST['msg'];
    // Make sure certain vars are present or else we do not send email yet
    if (!$senderName || !$senderEmail ) {
 
         $formMessage = "The form is incomplete, please fill in all fields.";
 
    } else { // Here is the section in which the email actually gets sent

        // Run any filtering here
        $senderName = strip_tags($senderName);
        $senderName = stripslashes($senderName);
        $senderEmail = strip_tags($senderEmail);
        $senderEmail = stripslashes($senderEmail);
        $senderMessage = strip_tags($senderMessage);
        $senderMessage = stripslashes($senderMessage);
        // End Filtering
         

        // Begin Email Message Body
      $message = 'THE MESSAGE


';

$message .= "</body></html>";
        // Set headers configurations
     $to= 'you';
     
     $bcc = "$contacts";
     $subject = "bret";
    
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
    $headers .= "Bcc: $bcc\r\n";
    $headers .= "From: no-reply@optiontradepit.com\r\n";
    
   
    

    mail( $to, $subject, $message, $headers );

      
       


       
        $formMessage = "Thanks, your message has been sent.";
        $senderName = "";
        $senderEmail = "";
        $senderMessage = "";
    } // close the else condition

} // close if (POST condition
?>

Recommended Answers

All 2 Replies

Member Avatar for diafol

The unsubscribe link goes into the body (message). What do you mean by tracking?

I don't understand the answer. Show how to insert the unsubscribe link into the message.

aprudente_99@yahoo.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.