| Author |
Message |
Miro
Joined: 05 Apr 2006 Posts: 43
|
|
Tell a friend |
|
I wonder if it's possible to send an article to someone (Tell a friend)?
|
|
| Thu Apr 13, 2006 12:29 am |
|
 |
Guest
|
|
|
Please login to hide the ads.
|
|
|
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
What exactly do you have in mind? What should it be like? Do you want it to send a link to the story or the story itself to the friend?
|
|
| Thu Apr 13, 2006 1:38 pm |
|
 |
Miro
Joined: 05 Apr 2006 Posts: 43
|
|
|
|
a link to the story will be nice 
|
|
| Thu Apr 13, 2006 2:34 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
1. Put a file mail_to_friend.php in your main CuteNews.Ru directory and put this in:
 |  | <?php
if($_POST['dosend'] == "yes"){
//Config subject
$subject = "Interesting article.";
//Config message
$message = "Hello {friend},\n\n";
$message .= "I found an interesting article:\n";
$message .= "Please check it out yourself: {url}\n\n";
$message .= "Best regards,\nYour name";
//Config mail
$mail_from = "yourmail@yourdomain.com";
//
$friend = $_POST['friend'];
$mail = $_POST['mail'];
$url = $_GET['url'];
$error = false;
if($friend == "" or $mail == ""){
$error = "Error! At least one field is empty. Please go back and fill out all the fields.";
}
$message = str_replace("{friend}", $friend, $message);
$message = str_replace("{url}", $url, $message);
$headers = 'From: '.$mail_from."\n";
$headers .= 'Reply-to: '.$mail_from."\n";
$headers .= 'Return-Path: '.$mail_from."\n";
$headers .= 'Message-ID: <'.md5(uniqid(time())).'@'.$_SERVER['SERVER_NAME'].">\n";
$headers .= 'MIME-Version: 1.0'."\n";
$headers .= 'Content-type: text/plain'."\n";
$headers .= 'Content-transfer-encoding: 7bit'."\n";
$headers .= 'Date: '.gmdate('D, d M Y H:i:s', time())."\n";
$headers .= 'X-Priority: 3'."\n";
$headers .= 'X-MSMail-Priority: Normal'."\n";
if(!$error){
mail($mail, $subject, $message, $headers);
echo "Thank you.<br />";
echo "The message was sent to ".$friend." (".$mail.")<br /><br />";
echo '<a href="javascript:window.close();">Close window</a>';
}
else echo $error;
}
else{
?>
<form action="" method="post">
<table>
<tr><td>Name:</td><td><input type="text" name="friend"></td></tr>
<tr><td>E-mail:</td><td><input type="text" name="mail"></td></tr>
<tr><td colspan="2"><input type="submit" value="Tell-a-Friend"></td></tr>
<input type="hidden" name="dosend" value="yes">
</table>
</form>
<?
}
?> |
2. Change the configuration at the top of this file.
3. Add this to your template:
 |  | <a onclick="window.open('{cutepath}/mail_to_friend.php?url={link=home/post}','','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no,width=370,height=285')" href="javascript:void(0);" title="Tell_a_Friend."><b>Mail to friend</b></a> |
Hope it works - I didn't really test it.
Last edited by FI-DD on Wed Apr 25, 2007 6:22 pm; edited 2 times in total |
|
| Thu Apr 13, 2006 4:15 pm |
|
 |
Miro
Joined: 05 Apr 2006 Posts: 43
|
|
|
|
Thank you FI-DI
but why I get this message after clicking the link:
 |  | Warning: Cannot modify header information - headers already sent by
(output started at /usr/home/web/mail_to_friend.php:2)
in /usr/home/web/mail_to_friend.php on line 34 |
and the message will not be sent.
|
|
| Fri Apr 14, 2006 5:34 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
Did you add something to the code of mail_to_friend.php?
|
|
| Sat Apr 15, 2006 3:41 pm |
|
 |
Miro
Joined: 05 Apr 2006 Posts: 43
|
|
|
|
nothing in the php codes. Only style sheets in the form.
|
|
| Sat Apr 15, 2006 4:45 pm |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
I changed the code above. Please try again.
|
|
| Sun Apr 16, 2006 5:54 pm |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 1943 Location: US |
|
|
|
Wow that's a lot fancier than I do that. I just use <textarea>'s for that and put the code between the textarea commands.. like:
Link to this: <textarea><a href="{home=link/post}" target="_blank">{title}</a></textarea>
Well I use that in the full story and then it fills itself out accordingly to the viewers when they go to the full story. That seems good enough for me. Is there a way to have it display JUST the URL in a textarea? If I put {home=link/post} do you think it would show just the URL? I haven't tried. I've only used {home=link/post} in an href... I'm not even sure if I'm writing that command right.. going from memory.
_________________ www.scottdizzle.com uses cnr
last update: 07-22-08: 8:30 pm |
|
| Fri Jun 09, 2006 12:51 pm |
|
 |
Falconer
Joined: 01 Feb 2006 Posts: 50
|
|
|
|
Works fine but it would be even better if the person who sends it, can add his name to it too, and perhaps give a small comment.
Ah, it's not so hard to add that. Works great now.
|
|
| Sat Jun 17, 2006 7:11 pm |
|
 |
scottdallas

Joined: 04 May 2006 Posts: 1943 Location: US |
|
|
|
You can add all sorts of ways to have 'tell your friends' things in your full story template. If you'd like I can find my code for aol IM and it would generate a message automatically so when you typed a screen name and hit send it would send a message to that person and say "Come check a href="{link=home/post}" target="_blank" this post /a out! You know what I mean? I had it in a textarea. Usually now though I just make textareas in the full story that say
Link to full story:
Text Link:
<textarea><a href="{link=home/post}" target="_blank">{title}</a></textarea>
I do lots of media sites so my full story is always just some embed code to some flash, video, or picture element.. so that's easy to make a copy and pastable textarea for:
Embed Link:
<textarea><a href="{link=home/post}" target="_blank">{title}</a><br>{full-story}<br><a href="http://www.yoursite.com" target="_blank">I got this from www.yoursite.com!</a></textarea>
The person would copy and paste that and it would obviously show the title on top of the embedded file with a link to the full story on your site, then show underneath the embedded element perfectly and then underneath give you credit and show a link back to the main page of your site. Fun things like that.
I'll see if I can work a mailer too so you could automatically mail things to people with the click of a button. That would be real nice... oh looks like there is the source above for that one. I'm gonna try that out.
_________________ www.scottdizzle.com uses cnr
last update: 07-22-08: 8:30 pm |
|
| Sun Jul 16, 2006 2:18 pm |
|
 |
ksen

Joined: 04 Jun 2006 Posts: 142
|
|
|
|
hi dere,
did anyone try the code above?? for some reason it doesnt seem towork on mine!! the only change made was to change the senders email!!
Thanx
|
|
| Fri Aug 25, 2006 5:17 pm |
|
 |
ksen

Joined: 04 Jun 2006 Posts: 142
|
|
|
|
i dont get any error messages as uch, instead i get a msg saying the message was successfully sent to the email address i specified. But the problem is i dont get a email with the url!!!
Any ideas pls??
thanx
|
|
| Fri Aug 25, 2006 6:51 pm |
|
 |
ksen

Joined: 04 Jun 2006 Posts: 142
|
|
|
|
Hi, any help pls?? i tryd my best cudnt figure out any error...
Pls?? Thanx so much
|
|
| Sun Aug 27, 2006 4:35 am |
|
 |
FI-DD
Admin

Joined: 22 Sep 2005 Posts: 2801 Location: Germany |
|
|
|
 |  | i dont get any error messages as uch, instead i get a msg saying the message was successfully sent to the email address i specified. But the problem is i dont get a email with the url!!! |
I guess it's in the spam folder then.
|
|
| Tue Aug 29, 2006 7:47 pm |
|
 |
|