I compared the ancient version with the current version and the file "include/contact.inc.php" has been changed.
Ancient version, line 236 - 293:
if(empty($errors))
{
$smarty->config_load($settings['language_file'],'emails');
$lang = $smarty->get_config_vars();
// send mail:
$ip = $_SERVER["REMOTE_ADDR"];
if(isset($_SESSION[$settings['session_prefix'].'user_name'])) $emailbody = str_replace("[user]", stripslashes($_SESSION[$settings['session_prefix'].'user_name']), $lang['contact_email_txt_user']);
else $emailbody = $lang['contact_email_txt'];
$emailbody = str_replace("[message]", stripslashes($text), $emailbody);
$emailbody = str_replace("[forum_address]", $settings['forum_address'], $emailbody);
$header = "From: ".$sender_email."\n";
$header .= "X-Mailer: PHP/" . phpversion(). "\n";
$header .= "X-Sender-ip: ".$ip."\n";
$header .= "Content-Type: text/plain; charset=".$lang['charset']."\n";
$header .= "Content-transfer-encoding: 8bit\n";
if($settings['mail_parameter']!='')
{
if(!@mail($recipient_email, stripslashes($subject), $emailbody, $header, $settings['mail_parameter'])) $errors[] = 'error_mailserver';
}
else
{
if(!@mail($recipient_email, stripslashes($subject), $emailbody, $header)) $errors[] = 'error_mailserver';
}
}
if(isset($errors))
{
$smarty->assign('errors',$errors);
if(isset($id)) $smarty->assign('id',$id);
if(isset($user_id)) $smarty->assign('recipient_user_id',$user_id);
if(isset($sender_email)) $smarty->assign('sender_email',htmlspecialchars(stripslashes($sender_email)));
if(isset($text)) $smarty->assign('text',htmlspecialchars(stripslashes($text)));
if(isset($subject)) $smarty->assign('subject',htmlspecialchars(stripslashes($subject)));
}
else
{
$smarty->assign('sent',TRUE);
// e-mail to sender:
$emailsubject = str_replace("[subject]", stripslashes($subject), $lang['contact_notification_sj']);
$emailbody = str_replace("[subject]", stripslashes($subject), $lang['contact_notification_txt']);
$emailbody = str_replace("[message]", stripslashes($text), $emailbody);
$emailbody = str_replace("[forum_address]", $settings['forum_address'], $emailbody);
$emailbody = str_replace("[recipient]", $recipient_name, $emailbody);
$header = "From: ".$settings['forum_email']."\n";
$header .= "X-Mailer: PHP/" . phpversion(). "\n";
$header .= "X-Sender-ip: ".$ip."\n";
$header .= "Content-Type: text/plain; charset=".$lang['charset']."\n";
$header .= "Content-transfer-encoding: 8bit\n";
if($settings['mail_parameter']!='')
{
@mail($sender_email, $emailsubject, $emailbody, $header, $settings['mail_parameter']);
}
else
{
@mail($sender_email, $emailsubject, $emailbody, $header);
}
}
Current version, line 275 - 299:
if(empty($errors))
{
// load e-mail strings from default language file:
$smarty->configLoad($settings['language_file'], 'emails');
$lang = $smarty->getConfigVars();
if(isset($_SESSION[$settings['session_prefix'].'user_name'])) $emailbody = str_replace("[user]", $_SESSION[$settings['session_prefix'].'user_name'], $lang['contact_email_txt_user']);
else $emailbody = $lang['contact_email_txt'];
$emailbody = str_replace("[message]", $text, $emailbody);
$emailbody = str_replace("[forum_address]", $settings['forum_address'], $emailbody);
if(!my_mail($recipient_email, $subject, $emailbody, $sender_email)) $errors[] = 'mail_error';
}
if(isset($errors))
{
$_SESSION[$settings['session_prefix'].'formtime'] = TIMESTAMP - 7; // 7 seconds credit (form already sent)
$smarty->assign('errors',$errors);
if(isset($id)) $smarty->assign('id',intval($id));
if(isset($user_id)) $smarty->assign('recipient_user_id',intval($user_id));
if(isset($sender_email)) $smarty->assign('sender_email',htmlspecialchars($sender_email));
if(isset($text)) $smarty->assign('text',htmlspecialchars($text));
if(isset($subject)) $smarty->assign('subject',htmlspecialchars($subject));
}
else
{
$smarty->assign('sent',TRUE);
}
In the ancient version, the PHP function mail() is called twice, both for $recipient_email and $sender_email. In the current version, my_mail() is only called once, for $recipient_email.
It would be great if MyLittleForum would send a copy of the email to the sender as well.
If this for some reason is not desirable, then a setting would allow the forum owner to choose whenether or not to use it. Or, it could be an option for the user that sends the email. A checkbox in the form. If the user check the checkbox, he will receive a copy. If he doesn't check the checkbox, he will not.
Best regards,
Daniel