I'm building a simple website where a form asks for an Artist Name, Email and a URL. Then, when the submit button is clicked, an email is sent to the "customer" with some details.
I want to give the effect that we are revising what he/she sent. For that I would need the email to be sent 30min/1h after the form was submitted. I haven't tried anything because I am pretty new with PHP and I couldn't find it anywhere else.
Here's my php:
<?php
if(isset($_POST['email'])) {
// EDIT THE BELOW TWO LINES AS REQUIRED
$email_to = "admin@domain.com";
$email_subject = "New repost submission, waiting for payment";
function errorMesg() {
// Error code can go here
echo "We are very sorry, but there were error(s) found with the form you submitted. ";
echo "<br /><br />";
echo "Please go back and fix these errors.<br /><br />";
die();
}
// validation expected data exists
if(!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['url'])) {
errorMesg();
}
$name = $_POST['name']; // required
$email_from = $_POST['email']; // required
$url = $_POST['url']; // required
$email_message = "Pendiente de pago, detalles:
";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message .= "Aritst: ".clean_string($name)."
";
$email_message .= "Email: ".clean_string($email_from)."
";
$email_message .= "Soundcloud Url: ".clean_string($url)."
";
// create email headers
$headers .= "From: Company <admin@website.com>
";
$headers .= "Reply-To: Company <admin@website.com>
";
$headers .= "Return-path: Company <admin@website.com>
";
$headers .= "Organization: Company
";
$headers .= "MIME-Version: 1.0
";
$headers .= "Content-type: text/plain; charset=iso-8859-1
";
$headers .= "X-Priority: 3
";
$headers .= "X-Mailer: PHP". phpversion() ."
";
/* Prepare autoresponder subject */
$respond_subject = "Thank you for submitting your music!";
/* Prepare autoresponder message */
$respond_message = "Hey, thank you for your submission!
Your track has been revised and approved by our team and now you will be able to reach more than 8,000,000 fans!
If you would like us to proceed with the promotion of your Soundcloud track, simply fill out this form:
https://website.com/accepted
All tracks must be submitted via our website form due to strict quality regulations.
Company wants to provide its fans the best new music and we won't settle for anything less.
Best regards,
Company.
";
/* Send the response message using mail() function */
mail($email_from, $respond_subject, $respond_message, $headers);
/* Send the message using mail() function */
mail($email_to, $email_subject, $email_message, $headers);
//redirect to the 'thank you' page
header('Location: ./success.html');
}
?>