Помогите, пожалуйста, сделать дополнительный заголовок Reply-To в динамической форме
пробовал так, но не получилось, плохо знаю php, (см. скрин заголовка пришедшего письма):
$replyto .= 'Reply-To: '. ($_POST['email']); // 'email' - это поле, в которое отправитель набирает свой емейл
$mail->setSender( array( $ckform->emailfrom, "" . $replyto ) );
код php:
/* Send Email Result */
if ($ckform->emailresult == 1) {
$mail =& JFactory::getMailer();
$mail->CharSet = "utf-8";
$mailBody = "Form : ".$ckform->title." [".$ckform->name."]<br />\n";
$mailBody = $mailBody."registered at ".date("Y-m-d H:i:s")."<br /><br />\n\n";
$n=count($ckform->fields );
for ($i=0; $i < $n; $i++)
{
$field = $ckform->fields[$i];
if ($field->typefield != 'button' && $field->typefield != 'fieldsep')
{
if (Isset($post[$field->name]))
{
$fieldValue = $post[$field->name];
} else
{
$fieldValue = '';
}
if (is_array ($fieldValue))
{
$arrayVal = "";
foreach($fieldValue as $selectValue){
$arrayVal = $arrayVal.$selectValue.",";
}
if (strcasecmp(substr($arrayVal, strlen($arrayVal) - strlen(",")),",") == 0)
{
$arrayVal = substr($arrayVal, 0,strlen($arrayVal) - strlen(","));
}
$fieldValue = $arrayVal;
}
$isEmail = false;
if ($field->typefield == 'text') {
$opt = explode("[--]", $field->defaultvalue);
$key1 = explode("===", $opt[0]);
$key2 = explode("===", $opt[1]);
$key3 = explode("===", $opt[2]);
$t_texttype = $key3[1];
if ($t_texttype == 'email') {
$isEmail = true;
}
}
}
}
$mailBody = $mailBody.JText::_( 'IP Address' ) . " : " . $_SERVER['REMOTE_ADDR'] . "<br />\n";
$articleid = JRequest::getCmd('articleid');
if (isset($articleid))
{
$mailBody = $mailBody.JText::_( 'Article ID' ) . " : " . $articleid . "<br />\n";
}
if (strcmp($ckform->emailto,"") != 0)
{
$mail->addRecipient( explode(",", $ckform->emailto) );
}
if (strcmp($ckform->emailcc,"") != 0)
{
$mail->addCC( explode(",", $ckform->emailcc) );
}
if (strcmp($ckform->emailbcc,"") != 0)
{
$mail->addBCC( explode(",", $ckform->emailbcc) );
}
$mail->setSender( array( $ckform->emailfrom, "" ) );
$mail->setSubject( $ckform->subject );
$mail->setBody( $mailBody );
$mail->IsHTML (true);
if (Isset($nb_uploaded_file) && $ckform->emailresultincfile == "1")
{
for ($i=0; $i < $nb_uploaded_file; $i++) {
$mail->addAttachment($uploaded_file[$i]);
}
}
$sent = $mail->Send();
}