- Code: Select all
<?php
if (empty($_POST['knownsender'])) {
$_POST['knownsender'] = '';
}
if (empty($_POST['recipients'])) {
$_POST['recipients'] = '';
}
if (empty($_POST['ccaddress'])) {
$_POST['ccaddress'] = '';
}
if (empty($_POST['subject'])) {
$_POST['subject'] = '';
}
if (empty($_POST['message'])) {
$_POST['message'] = '';
}
$mailtos = $_POST['recipients'];
$subject = $_POST['subject'];
$message = $_POST['message'];
if (($_POST['ccaddress'] == "") || ($_POST['ccaddress'] == " ")) {
$header = "From: $_POST[knownsender]";
} else {
$header .= "From: $_POST[knownsender]\r\n";
$header .= " Cc: $_POST[ccaddress]";
}
if (@mail($mailtos, $subject, $message, $header)) {
echo "<i>".$TEXT['mail-sendok']."</i>";
} else {
echo "<i>".$TEXT['mail-sendnotok']."</i>";
}
?>
This code is placed in mailsend.php of xampp directory.
This works perfect, but I prepared a mail page and added:
- Code: Select all
mail("mymail@domain.com","Subj","a message")
Although this seems to be true, Mercury mail didnt show any message to make sure my mail was sent. How can I simplfy the mail function?