Re: Tell A Friend Extension
Haven't used it, but you could place it as a content element on a hidden page - and create a button with a custom html module that links to the hidden page - and place this button wherever in your page layout.
Make sense to you?
Re: Tell A Friend Extension
Quote:
Originally Posted by ramjet
Haven't used it, but you could place it as a content element on a hidden page - and create a button with a custom html module that links to the hidden page - and place this button wherever in your page layout.
Make sense to you?
The problem is that it would only send a referral to itself.
I have written my own simple php script that sends referral links.
It's working, but it's using the classic php mail() function, how could I make it hook into Contaos emailing capabilities?
Re: Tell A Friend Extension
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).
Re: Tell A Friend Extension
In a module it would work like this...
not sure about from imported script, but try.
Code:
$objEmail = new Email();
$objEmail->from =
$objEmail->fromName =
$objEmail->subject =
$objEmail->text = if plain text
$objEmail->html = if html formatted
$objEmail->sendTo($therecipient);
//log acknowledgement if not failure, else log failure
if (!$objEmail->failures)
{
$this->log('Log Success Message', 'Where From', TL_GENERAL);
}else
{
$this->log('Log Failure Message', 'Where From', TL_ERROR);
}
Re: Tell A Friend Extension
Thanks, I tried that, but nothing happened.
I think I need to import the classes and libraries into my external php script?
But I am not sure how to do that.
Edit: sorry I was too quick, it did work, thank you!