I am using Simple Mail from PHP. Now I have the intention of knowing the life time of an email.
If a user wishes to send email one day after submitting the form, how can I achieve this in PHP?
$headers = 'From: '.$Name.''. '\r\n' . 'Reply-To: '.$_POST['email'].'' . '\r\n' . 'X-Mailer: PHP/' . phpversion(); $subject = 'Subject'; $message = 'Message'; mail($to, $subject, $message, $headers);
Is there a header I need to include?
I don’t think there is a way for you to set the delivery date of the message while sending the message.
You can save the email message in a database and run a cron job every day to check for emails that has to be sent that day and send them.
The life time of the email is different. For example, if you have sent an email and for some reason if the message was not delivered, it will queued. And the server will try to deliver the message after some time and still if it is not able to deliver the message, the server will delete the email.