To give you some more information:
I created two external php scripts:
1. file 1 gets the referring url and displays a form:
Code:
<?php
//get the referring url
$refurl = $_SERVER["HTTP_REFERER"]
//show the form
?>
<?php
echo 'The page you are recommending is:
';
echo $refurl . '
';
?>
<form id="tl_registration" action="http://www.server.com/index.php/pagerecsend.html" method="post">
<table>
<tr>
<td width="100px">Your Name*</td>
<td><input class="text mandatory" type="text" name="fsendname">
</td>
</tr>
<tr>
<td width="100px">Recipient Name*</td>
<td><input class="text mandatory" type="text" name="fname">
</td>
</tr>
<tr>
<td width="100px">Recipient Email*</td>
<td><input class="text mandatory"type="text" name="femail">
</td>
</tr>
<tr>
<td><input type="hidden" name="furl" value="<?php echo $refurl ?>"></td>
<td align="right"><input class="pagerec_submit" type="submit" value="Send"></td>
</tr>
</table>
</form>
2. file 2 takes the information and mails it:
Code:
<?php
//get all the form data
//strip any tags from the user entry
$to = strip_tags($_POST["femail"]);
$body = 'Hello '.strip_tags($_POST["fname"]).','." \r\n ".strip_tags($_POST["fsendname"]).' would like to recommend the following page to you:'. "\r\n".$_POST["furl"];
$subject = "Page Recommendation";
$header = 'From: webmaster@server.com' . "\r\n" .
'Reply-To: webmaster@server.com' . "\r\n" .
'To: '. $to . "\r\n" .
'X-Mailer: PHP/' . phpversion();
//mail it all
if (mail($to, $subject, $body, $header)) {
echo("
Message successfully sent!</p>");
} else {
echo("
Message delivery failed...</p>");
}
?>
I imported each php script on to a page in Contao.
It's all working.
Now what I would like to do instead of using mail() is hook into Contaos mail feature because the emails are getting stuck in my spam filter.
Any help or tips appreciated.
(I know it would be better to create a proper Contao module, but i dont know how to do that at this point).
Bookmarks