I think my problem is a little more complicated.
I'm using Hot Property and with every property page, there is a sendenquiry form. This form is sent by HP, but you can configure it to use mosmail. That's why I thought changing it to mosmail and then fixing the Joomla form could do the job. But I don't understand that whole copy to sender thing.
It'll probably do nothing in my case. Hopefully it is helpful for the others.
I'll just paste a 'little bit' of code from my situation. If you have time and knowledge and want to help, thanks! If not, I understand. I already tried on the HP forum (forum.mosets.com), but I'm not really getting any answers. Someone showed me this topic.
function sendEnquiry() {
global $database, $Itemid, $mosConfig_live_site, $mosConfig_sef, $option;;
$id = intval( mosGetParam( $_REQUEST, 'id', 0 ) );
$sbj = trim( strtolower( mosGetParam( $_POST, 'sbj', '' ) ) );
# Redirect to main listing if property/agent is invalid or not unpublish
if ($id == 0) mosRedirect(sefRelToAbs('index.php?option=com_hotproperty&Itemid='.$Itemid));
if (empty($sbj)) mosRedirect(sefRelToAbs('index.php?option=com_hotproperty&Itemid='.$Itemid));
if ($sbj == "property") {
if (!HP_isPropPublished($id)) mosRedirect(sefRelToAbs('index.php?option=com_hotproperty&Itemid='.$Itemid));
} elseif ($sbj == "agent") {
$database->setQuery("SELECT id FROM #__hp_agents WHERE id='".$id."' LIMIT 1");
$agentid = $database->loadResult();
if ( empty($agentid) ) {
mosRedirect(sefRelToAbs('index.php?option=com_hotproperty&Itemid='.$Itemid));
}
} elseif ($sbj == "company") {
$database->setQuery("SELECT id FROM #__hp_companies WHERE id='".$id."' LIMIT 1");
$companyid = $database->loadResult();
if ( empty($companyid) ) {
mosRedirect(sefRelToAbs('index.php?option=com_hotproperty&Itemid='.$Itemid));
}
}
# Assign form's value
$hp_email = trim( mosGetParam( $_POST, 'hp_email', '' ) );
$hp_contactnumber = trim( mosGetParam( $_POST, 'hp_contactnumber', '' ) );
$hp_name = trim( mosGetParam( $_POST, 'hp_name', '' ) );
$hp_enquiry = trim( mosGetParam( $_POST, 'hp_enquiry', '' ) );
# Validate form's data
if (!$hp_name || !$hp_enquiry){
echo "alert (\""._HP_CONTACT_ERR_COMPLETE."\"); window.history.go(-1);";
exit(0);
}
if (!$hp_email && !$hp_contactnumber){
echo "alert (\""._HP_CONTACT_ERR_ONECONTACT."\"); window.history.go(-1);";
exit(0);
}
if ($hp_email && !is_email($hp_email)) {
echo "alert (\""._HP_CONTACT_ERR_VALIDEMAIL."\"); window.history.go(-1);";
exit(0);
}
# Get agent's email & name, Property's title
if ($sbj == "property") {
$sql = "SELECT a.name AS name, a.email AS email, p.name AS propTitle FROM #__hp_properties AS p"
. "\nLEFT JOIN #__hp_agents AS a ON a.id=p.agent"
. "\nWHERE p.id='".$id."'";
} elseif ($sbj == "agent") {
$sql = "SELECT a.name AS name, a.email AS email FROM #__hp_agents AS a"
. "\nWHERE a.id='".$id."'";
} elseif ($sbj == "company") {
$sql = "SELECT c.name AS name, c.email AS email FROM #__hp_companies AS c"
. "\nWHERE c.id='".$id."'";
}
$database->setQuery($sql);
$database->loadObject($agent);
$email_to = $agent->email;
# Construct the email
$text = ""._HP_CONTACT_ENQUIRY_TEXT.$hp_name;
$text .= "\n"._CMN_EMAIL.": ". $hp_email . "\n"._HP_CONTACTNUMBER.": ".$hp_contactnumber."\r\n".stripslashes($hp_enquiry);
if ($sbj == "property") {
$text .= "\n\n"._HP_CONTACT_ENQUIRY_TEXT2;
$text .= "\n\n\t";
if ($mosConfig_sef) {
$url = sefRelToAbs("index.php?option=com_hotproperty&task=view&id=$id");
} else {
// Get Itemid
$database->setQuery("SELECT id FROM #__menu WHERE link='index.php?option=$option'");
$Itemid = $database->loadResult();
$url = $mosConfig_live_site .'/'. "index.php?option=com_hotproperty&task=view&id=$id&Itemid=$Itemid";
}
$text .= $url;
}
if ($sbj == "property") $subject = _HP_CONTACT_ENQUIRY_SUBJECTP.$agent->propTitle;
elseif ($sbj == "agent") $subject = _HP_CONTACT_ENQUIRY_SUBJECTA;
elseif ($sbj == "company") $subject = _HP_CONTACT_ENQUIRY_SUBJECTC;
$headers .= "From: ".$hp_name." \r\n";
$headers .= "Reply-To: \r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Low\r\n";
$headers .= "X-Mailer: Hot Property\r\n";
# Send the email
@mail($email_to, $subject, $text, $headers);
mosMail($hp_email,$hp_name,$email_to,$subject,$text);
if ($sbj == "property") { ?>
alert(""); document.location.href='';
alert(""); document.location.href='';
alert(""); document.location.href='';
<?php }
}