checkboxes that don’t obey.
$docFields:
Array
(
[withSauce] => Array
[formid] => testForm
)
$_POST:
Array
(
[formid] => testForm
[withSauce] => Array
(
[0] => Yes
[1] => Double
)
)
...
# format report fields
foreach($fields as $name => $value) {
$fld = $formats[$name];
if ($fld) {
$datatype = $fld[2];
if ($datatype != 'email') $value = str_replace('@', '[at]', $value); // INSERT THIS LINE HERE
switch ($datatype) {
...1) The message may not get through.
2) A reply will quote the form contents, which might contain information that you don’t want the customer to see
3) You might not want to have email address as a required field.
# send form
if(!$noemail) {
if($sendirect) $to = $fields['email'];
$mail = new PHPMailer();
$mail->IsMail();
$mail->IsHTML(true);
$mail->From = $from;
$mail->FromName = $fromname;
$mail->Subject = $subject;
$mail->Body = $report;
$mail->AddReplyTo($fields['email']); //ZAP added this
AddAddressToMailer($mail,"to",$to);
AddAddressToMailer($mail,"cc",$cc);
AddAddressToMailer($mail,"bcc",$bcc);
AttachFilesToMailer($mail,$attachments);
if(!$mail->send()) return $mail->ErrorInfo;
}<?php # Snippet customize settings $params = array ( // Snippet Path snipPath => $snipPath, // eForm Params vericode => isset($vericode)? $vericode:"", formid => isset($formid)? $formid:"", from => isset($from)? $from:$modx->config['emailsender'], fromname => isset($fromname)? $fromname:$modx->config['site_name'], //added by TobyL replyto => isset($replyto)? $replyto:'', // to => isset($to)? $to:$modx->config['emailsender'], cc => isset($cc)? $cc:"", bcc => isset($bcc)? $bcc:"", subject => isset($subject)? $subject:"", ccsender => isset($ccsender)? 1:0, sendirect => isset($sendirect)? 1:0, mselector => isset($mailselector)? $mailselector:0, mobile => isset($mobile)? $mobile:'', mobiletext => isset($mobiletext)? $mobiletext:'', autosender => isset($autosender)? $autosender:$from, autotext => isset($automessage)? $automessage:"", category => isset($category)? $category:0, keywords => isset($keywords)? $keywords:"", gid => isset($gotoid)? $gotoid:$modx->documentIdentifier, noemail => isset($noemail)? true:false, saveform => isset($saveform)? ($saveform? true:false):true, tpl => isset($tpl)? $tpl:"", report => isset($report)? $report:"", allowhtml => isset($allowhtml)? 1:0, format => isset($format)? $format:"" ); ?>
<?php
# include PHP Mailer
include_once "manager/includes/controls/class.phpmailer.php";
//mod by TobyL
//set reply-to address
//$replyto snippet parameter must contain fieldname
$replyto = ( $fields[$replyto] && strstr($fields[$replyto],'@') )?$fields[$replyto]:$from;
//end mod
# send form
if(!$noemail) {
if($sendirect) $to = $fields['email'];
$mail = new PHPMailer();
$mail->IsMail();
$mail->IsHTML(true);
$mail->From = $from;
$mail->FromName = $fromname;
$mail->Subject = $subject;
$mail->Body = $report;
AddAddressToMailer($mail,"to",$to);
AddAddressToMailer($mail,"cc",$cc);
AddAddressToMailer($mail,"bcc",$bcc);
//mod by TobyL - add reply-to address
AddAddressToMailer($mail,"replyto",$replyto);
//end mod
AttachFilesToMailer($mail,$attachments);
if(!$mail->send()) return $mail->ErrorInfo;
}
?>
<?php
# Adds Addresses to Mailer
function AddAddressToMailer(&$mail,$type,$addr){
$a = explode(",",$addr);
for($i=0;$i<count($a);$i++){
if(!empty($a[$i])) {
if ($type=="to") $mail->AddAddress($a[$i]);
elseif ($type=="cc") $mail->AddCC($a[$i]);
elseif ($type=="bcc") $mail->AddBCC($a[$i]);
//mod by TobyL - add replyto field
elseif ($type=="replyto") $mail->AddReplyTo($a[$i]);
//end mod
}
}
}
?>

Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in c:\appserv\www\assets\snippets\eform\eform.inc.php on line 178
Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in c:\appserv\www\assets\snippets\eform\eform.inc.php on line 259
This discussion is closed to further replies. Keep calm and carry on.