Hi - I have the following php script in place on my site. I use it on a site where people can place a classified ad. This part of the script allows a buyer to contact the seller through the site. I am wondering how I go about adding a function to the script which will write the url to the listing the person is responding to in the email itself. Example, in the email, it would have their message they type in, but before that, it would say something like:
"You have received a message regarding your ad at: <url> - Please use the "Reply To" button to reply directly to this buyer.
<message from buyer>
How would I go about doing this? Thanks!!
<?
require_once("conn.php");
require_once("includes.php");
//get the agent info
$q1 = "select * from class_members where MemberID = '$_GET[MemberID]' ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);
if(isset($_POST[s1]))
{
$to = $a1[email];
$subject = $_POST[subject];
$message = $_POST[message];
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: $_POST[u_name] <$_POST[u_email]>\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP/" . phpversion()."\n";
if(strpos(strtolower($to),"aol.com")>0)
{
socketmail($to,$subject,$message,$POST[u_email],$POST[u_name]);
}
else
{
mail($to, $subject, $message, $headers);
}
//get the templates
require_once("templates/HeaderTemplate.php");
require_once("templates/ContactOKTemplate.php");
require_once("templates/FooterTemplate.php");
exit();
}
$MemberName = "$a1[FirstName] $a1[LastName]";
//get the templates
require_once("templates/HeaderTemplate.php");
require_once("templates/ContactTemplate.php");
require_once("templates/FooterTemplate.php");
?>
<?php
function socketmail($toemail, $subject, $message,$fromemail1,$fromname)
{
$fromemail = "yourad@yourdomain.com";
ini_set(sendmail_from, $fromemail);
$connect = fsockopen ("mailin-01.mx.aol.com", 25, $errno, $errstr, 30) or die("Could not talk to the sendmail server!");
$rcv = fgets($connect, 1024);
fputs($connect, "HELO {$_SERVER['SERVER_NAME']}\r\n");
$rcv = fgets($connect, 1024);
$rcv = fgets($connect, 1024);
$rcv = fgets($connect, 1024);
$rcv = fgets($connect, 1024);
$rcv = fgets($connect, 1024);
$rcv = fgets($connect, 1024);
$rcv = fgets($connect, 1024);
fputs($connect, "MAIL FROM: <$fromemail>\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "RCPT TO: <$toemail>\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "DATA\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "Subject: $subject\r\n");
fputs($connect, "From: $fromemail1 <$fromemail\r\n");
fputs($connect, "Reply-To: <$fromemail1>\r\n");
fputs($connect, "To: $toKey <$toValue>\r\n");
fputs($connect, "X-Sender: <$fromemail>\r\n");
fputs($connect, "Return-Path: <$fromemail1>\r\n");
fputs($connect, "Errors-To: <$fromemail1>\r\n");
fputs($connect, "X-Mailer: PHP\r\n");
fputs($connect, "X-Priority: 3\r\n");
fputs($connect, "Content-Type: text/plain; charset=iso-8859-1\r\n");
fputs($connect, "\r\n");
fputs($connect, stripslashes($message)." \r\n");
fputs($connect, ".\r\n");
$rcv = fgets($connect, 1024);
fputs($connect, "RSET\r\n");
$rcv = fgets($connect, 1024);
fputs ($connect, "QUIT\r\n");
$rcv = fgets ($connect, 1024);
fclose($connect);
ini_restore(sendmail_from);
}
?>