I want to get an email notification sent to me from the site when someone fills out form and downloads content from my site. How can I do that?
2 Answers
Use the Email from Template add-on and include either on the page offering the download button, on a confirmation page after clicking button, or trigger via an ajax call on clicking the download button (along with firing the download).
One way, there are probably plenty more, is via PHP in the form when it is submitted. Remember, for this you would need to enable PHP on INPUT for the Form. I am sure that a LOT of people on this Forum would cringe with this approach, but as I said, this is one way.... Also, this is using the POST not the GET method....
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
$to = "[email protected]";
$subject = "This is subject";
$message = "<b>This is HTML message.</b>";
$message .= "<h1>This is headline.</h1>";
$header = "From:[email protected] \r\n";
$header .= "Cc:[email protected] \r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html\r\n";
$retval = mail ($to,$subject,$message,$header);
if( $retval == true ) {
echo "Message sent successfully...";
}else {
echo "Message could not be sent...";
}
}
?>
Your HTML code would follow the "?>".