我正在尝试编写一个脚本,该脚本可让我在任何给定时间发送电子邮件。 例如,我要发送日期为2018年的电子邮件。 这可能吗?
<?php
session_start();
$f_Submit = filter_var($_POST['submit'],FILTER_SANITIZE_STRING);
if ($f_Submit == 'Send')
{
if (strcmp(md5(filter_var($_POST['user_code'],FILTER_SANITIZE_STRING)),$_SESSION['ckey']))
{
$header = "Location: ".basename ( __FILE__,"php")."php?msg=ERROR: Invalid Verification Code";
header($header);
exit();
}
//------------------ Sanitizin the Input Variables ------------------//
$f_fromname = filter_var($_POST['fromname'],FILTER_SANITIZE_STRING);
$f_fromemail = filter_var($_POST['fromemail'],FILTER_SANITIZE_EMAIL);
$f_reply = filter_var($_POST['reply'],FILTER_SANITIZE_EMAIL);
$f_toemail = filter_var($_POST['toemail'],FILTER_SANITIZE_EMAIL);
$f_bccemail = filter_var($_POST['bccemail'],FILTER_SANITIZE_EMAIL);
$f_subject = filter_var($_POST['subject'],FILTER_SANITIZE_STRING);
$f_message = filter_var($_POST['message'],FILTER_SANITIZE_STRING);
//-------------------------------------------------------------------//
$date = new DateTime('2000-01-01');
$result = $date->format('D, d M Y H:i:s O');
if($f_reply=="") {
$f_reply = $f_fromemail;
}
// Header
$headers = 'From:'.$f_fromname.' '.'<'.$f_fromemail.'>'. "\r\n";
$headers .= "Date: ".$result." \r\n";
$headers .= 'Bcc: '.$f_bccemail. "\r\n";
$headers .= 'Cc: ' . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
?>
$ result变量不起作用。如果我发送邮件,它将显示发送邮件的日期,而不是我尝试设置的日期。