Thanks for the detailed response! I think I'll leave the Joomla! mail function alone and just use my existing contact page with the code you provided. This is my mailing script code:
Code:
$smtp = Mail::factory('smtp', array ('host' => 'mail.mydomain.com',
'auth' => true,
'username' => 'smtpuser@domain.com' ,
'password' => 'password'));
$to = 'message_recipient@domain.com' ;
$from = 'sender_address@domain.com';
$name = $_REQUEST['Name'] ;
$subject = "Get a Quote";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$fields = array();
$fields{"Name"} = "Name";
$fields{"Item"} = "Item";
$fields{"Email"} = "Email";
$fields{"Phone"} = "Phone";
$fields{"Message"} = "Message";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$subject2 = "Thank you for contacting Smart Office Advisors";
$to2 = $_REQUEST['Email'];
$autoreply = "Thank you for contacting us.
Someone from our office will contact you within 24 hours regarding your inquiry.";
$headers2 = array ('From' => $to,
'To' => $to2,
'Subject' => $subject2);
if($Email == '') {print "You have not entered an email, please go back and try again";}
else
{
if($name == '') {print "You have not entered a name, please go back and try again";}
else
{
$send = $smtp->send($to, $headers, $body);
$send2 = $smtp->send($to2, $headers2, $autoreply);
if(PEAR::isError($send))
{
print "We encountered an error sending your mail, please notify support@domain.com";
}
else
{
header( "Location: http://www.smartofficeadvisors.com/product_thankyou.php" );
}
}
}
Could you please let me know how to reference the 'productname' variable passed from the link? I think I know where to insert it, but I'm not sure how to reference it.
Once I get that part, I'll just add a link (button) to each of the listings with a unique 'productname' - sound right?
Thanks again for all the help!