Module Testers Wanted: Email This Page

Nick Wilson - April 27, 2004 - 11:01

Hi,

if any of you have the time, i'd be most gratefull if you would download, install and try out the emailpage.module

It works great for me on a couple of sites, but I'd love to get feedback, suggestions and bug reports.

What does it do?

This module adds a link to the navigation, and to every FULL node (not the main page teasers) to the emailpage script. Then users can send any page to a friend easily. (at least in theory hehehe!)

Download it Here

http://83.88.179.12/emailpage.module

Installing

Simply copy the file to your drupal modules directory, then go to the modules menu and enable it. Then go to the settings page (click the modules link again and it will appear) and alter it to suit.

Current Issues

One user says he sees no links on nodes, i've no idea why and would like to know if anyone else has this.
The default email address reads NoReply@www.example.com it should not contain the www, i'm working on that....

Feedback

Please post to this thread ;)

thanks all

Nick

Test results

sskennel - April 27, 2004 - 15:12

I clicked on the Send it Now! button and got:

Not Found

The requested URL /emailpage was not found on this server.
Apache/2.0.48 (Fedora) Server at loiosh.ne.client2.attbi.com Port 80

My test site isn't at the Web server's root. Here's a patch:

--- emailpage.module.orig    2004-04-27 10:46:35.000000000 -0400
+++ emailpage.module       2004-04-27 10:53:00.000000000 -0400
@@ -78,7 +78,7 @@
   if($error) {
     $content="<p class=\"error\">$error</p>";
   }
-  $content.=form($form, "post", "/emailpage");
+  $content.=form($form, "post", "emailpage");
   $content.="<h2>Example  Email</h2>\n";
   $content.="<p><strong>Subject: </strong>[Your Name] ".variable_get('emailpage_subject_line', "thought you'd like to see this")."</p>\n\n<p>".$_SERVER['HTTP_REFERER']."</p>\n\n<p>[Your Name] ".nl2br(variable_get('emailpage_message',"someone thought you would like this page\n"))."</p>";

I think the referer approach is fundamentally the wrong choice. If there are fifteen stories on the main page and the one I want to email is too short to need a read more link, I can't easily get to a place where I can email a link to that story. The best I can do is email a link to the main page and hope the story is still there when the recipient arrives to see it.

A much better approach would be to encode the nid in every email this page URL and put the link on both on full stories and on teasers. That would also make the navigation menu item unnecessary.

Roger H. Goun

Brentwood, NH

"$content.=form($form, "post"

Steven - April 27, 2004 - 15:23

"$content.=form($form, "post", "emailpage");"

You should wrap the url through url(). That way it still works without Clean URLs.

Which bit?

Nick Wilson - April 27, 2004 - 15:39

Which bit Steven? - Care to show me how? I know that's the right route, but couldnt work it out....

Cheers!

Nick

Right

Nick Wilson - April 27, 2004 - 15:38

sskennel, yes, i do see your point.

In an ideal world i'd like the link under the nav to work on the referer (so you can indeed email main pages etc...) and the node link to work with the nid.

However, here are the trouble spots as far as coding it is concerned (for me):

  • I dont know how to make sure that everyone gets the correct link. EX: if clean urls are not enabled, or if 'node' is somthing different. (you can change that right?) I can pass the nid to the emailpage script easily, but THEN what do I do with it? It's gotta work for everyone of course.....
  • Anyone care to help or put me on the right path for generating links with only a nid to work with that will work for everyone...?

Much thanks for the comments, look forward to thoughts on the url business...

Nick

New And Improved!

Nick Wilson - April 28, 2004 - 08:39

Okay,

So, I now have the node links working correctly (not using http_referer) and all is well!

I've also added the option of having the link created according to node type. like "email this recipe" or "blog" or "article" etc...

Enjoy!
http://83.88.179.12/emailpage.module

Nick

What about comments?

droopy - April 28, 2004 - 09:50

It works fine for nodes but not comments - I just get 'email this' in the link. It would help to see 'email this comment' and for the comment reference to be included in the link that is emailed, eg. node/view/313#comment-343. Anyway, thanks - it's a useful module.

Oh well....

Nick Wilson - April 28, 2004 - 10:56

Ooops!

I hadn't noticed that. I cant immediatly see a way around it, the function in question is emailpage_link() if anyone would care to take a look at it and see if this can be sorted...?

Nick

Not so sure...

droopy - April 28, 2004 - 13:25

On further examination now I'm not so sure it's working. Everything looks fine until I try to send the link at which point I am returned directly to the home page (no success message) and no email is sent. Try it and see. As far as I can tell it doesn't set the cookie. I'm pretty sure the original version sent out the email as expected.

Okay, All is Well

Nick Wilson - April 28, 2004 - 14:19

Working now, minor misshap when we went the $node->nid route. I wont bore you with the details but it's all cool now..

http://83.88.179.12/emailpage.module

Sorry about that droopy ;)

Nick

Cookie not updating

droopy - April 28, 2004 - 15:09

Two further problems:

1. The link usually does not appear in the example email (but does in the real email).

2. It looks like the the cookie is not being updated after an email is sent so that the same link gets sent each time - unless you delete the cookie and start again. I suspect this also accounts for problem #1. The first time after the cookie is deleted the link appears in the example email.

Comments

droopy - April 28, 2004 - 15:38

I commented out the if(!$_COOKIE['referer']) line in emailpage_page and this seems to have fixed it for me. Does that make sense?

I also made some changes that allow links to comments. You can see it in action here. This is the altered link function with images filtered out. It's a bit longwinded:

function emailpage_link($type, $node=0, $main=0) {
  $links=array();
  if (($type == "system")) {
  // URL, page title, func called for page content, arg, 1 = don't disp menu
    menu("emailpage", t("email this page"), "emailpage_page", 1, 1);
  }

  // This var is set in the settings section under the admin/modules/emailpage section
  // It shows 'email this $nodetype' or 'email this page'
  $e_l_t=variable_get('emailpage_link_type', 0);
  if($e_l_t) {
    if ($type == "comment") {
    $e_l_t="comment";
    $links[] = l(t("<img border=\"0\" src=\"images/mail2.gif\"width=\"15\" height=\"10\">"), "emailpage&nid=$node->nid&cid=$node->cid", array("title" => t("Email this ".$e_l_t." to a friend")), NULL);
    }
    else {
    $e_l_t=$node->type;
    $links[] = l(t("<img border=\"0\" src=\"images/mail2.gif\"width=\"15\" height=\"10\">"), "emailpage&nid=$node->nid", array("title" => t("Email this ".$e_l_t." to a friend")), NULL);
    }
  } else {
  $e_l_t="page";
  $links[] = l(t("<img border=\"0\" src=\"images/mail2.gif\"width=\"15\" height=\"10\">"), "emailpage&nid=$node->nid", array("title" => t("Email this ".$e_l_t." to a friend")), NULL);
  }
  return $links;
}

This is what I did with the GET statements. I'm a complete novice at this so it may look awful:

//  if(!$_COOKIE['referer']) {
    if($_GET['nid']) {

    $nod=$_GET['nid'];
    if (!$_GET['cid']) {
    $comm="";
    }
    else {
    $comm="#comment-" . $_GET['cid'];
    }
    $nodelink=$base_url.'/'.url('node/view/'. $nod . $comm);


      // Set the refering page in a cookie
      setcookie('referer', $nodelink, time()+600, '/', ".".$host['host']);
    } else {
      $nodelink=$base_url;
    }
//  }

Comment not working

Nick Wilson - April 29, 2004 - 10:02

Hi again,

The mods u made dont work for me, though i've sorted out the cookie/example mails problem....

I'll work on the comment thingy over the next couple of days and post back here when it's sorted.

Thanks for all the assistance droopy!

http://83.88.179.12/emailpage.module

Nick

Download here

droopy - April 29, 2004 - 15:50

If it's any use (I may have got something wrong in the earlier post), you can download my modified version:

http://www.opensourcetheology.net/emailpage.module.txt

keeps looping on "You must supply your name and a valid email"

Dublin Drupaller - May 3, 2004 - 11:50

Heya!

Tried it out...nice one....everything works up to the point that it loops on the error message: "You must supply your name and a valid email address" after clicking submit...

Jason

Where?

Nick Wilson - May 3, 2004 - 16:21

Hi Jason, do you mean on my version or droopys altered one? (sorry droopy, busy weekend, back on track during the week!)..

I couldn't duplicate the error, can you tell me how you did it and what the results were?

Cheers!

Nick

er....nick.....(cringe!)

Dublin Drupaller - May 3, 2004 - 16:58

Nick...

Before I reply...let me just point out that I am:

a) as thick as a plank

b) Am extremely new to drupal & php...never used it before..have done a bit of perl which isn't a million miles away, but, have been at the drupal thing for just over a week.

c) it's a very sunny day in dublin today.

d) the pubs close at 11:00...

ENOUGH! Disclaimer over..it worked!

All i did was download the module again. Saved it to my hard disk. uploaded it to the modules folder. went into Admin ->>config-->>modules...Enabled it and it worked first time.

No idea why it didn't work earlier.

Apologies if I caused worry.

Great feature...cheers

Jason

Tried ...

gde - May 3, 2004 - 16:53

http://www.opensourcetheology.net/emailpage.module.txt

but get this

"Not Found
The requested URL /drupal/emailpage was not found on this server."

Sorry :-(

But the concept is great :-)

i just downloaded that a few minutes ago...

Dublin Drupaller - May 3, 2004 - 17:01

Heya Gde..

I just downloaded that emailpage.module.txt file...worked first time..

If you're on a PC with windows, hover over the link..click on the right mouse button and select "SAVE TARGET AS".

Jason

It downloaded and installed ok...

gde - May 4, 2004 - 05:21

but the errormsg is what I get when trying to send an email via the form.
Any suggestions?

Hmmmm

Nick Wilson - May 4, 2004 - 07:17

Unless you're using an ancient version of PHP there should be no reason for that. For now, it's probably best to use my non-comment-friendly version till I get droopys mods incorporated properly: http://83.88.179.12/emailpage.module

btw, no worries Jason! ;-)

Is the site live? - If so, can i take a look?

Installed the recommended one ...

gde - May 4, 2004 - 08:19

but I still get the pesky ...Not found!
:-(

You can check my Drupal here
http://as22-3-1.mt.g.bonet.se/drupal/

Right!

Nick Wilson - May 4, 2004 - 08:37

Okay, pretty sure that's fixed now. We had this trouble a little earlier when the drupal install wasn't at root. And you're not using clean urls.

The trick b4 was to use the url() function to wrap the links, i just noticed that the 'action' of the form is not wrapped in the url function and have rectified that.

Try it now, (http://83.88.179.12/emailpage.module) and I'll check back in a couple of hours...

Nick

It is not my day...

gde - May 4, 2004 - 08:47

I should probably try to use clean urls but cannot fix that right now since I'm at work and should do everything else but this ;-)

I'll dig into this more tonite which should be in about 8 hours.

Thanks for your patience :-)

?

Nick Wilson - May 4, 2004 - 09:00

So it didnt work?

I'll check back here later and we'll get this fixed ;-) It's good your not using clean urls, and your install is not root. Gives us a good opportunity to make sure it works for everyone!

Catch you later, though that may be this time again for me as I have a busy evening ahead...

cya

Nick

New Features!

Nick Wilson - May 7, 2004 - 12:36

Ok,

Firstly, you can download it here: http://83.88.179.12/emailpage.module

New Features

First of all, i added a field to the settings page that will allow you to chose whether the link is put on teasers/nodes on index pages (main pages). Personally i think it's just cluttering up the index pages and who would email a paragraph or 2? - The choice is yours...

Second, with much thanks to droopy, I've made it play nicely with comments. Cheers droopy!

Bugs

Well, i cant find any! ;)
I've tried it on these types of install and it works great:

  • Clean urls on a root level install
  • Clean urls on a subdir install
  • Normal urls on a root install
  • Normal urls on a subdir install

If anyone has any problems, please let me know. And if anyone knows how I submit this damn thing to the drupal project, do tell...





Cheers



Nick

RE: emailpage...

gde - May 7, 2004 - 14:31

Nick,
You're my man :-)

It works like a charm and I just wish I could tell you how to submit this beauty to the Drupal project.

Re: New Features

gde - May 7, 2004 - 14:53

Nick,
How spam proof is this module?
Cheers

Spam

Nick Wilson - May 8, 2004 - 08:06

Not very.

It's the next improvement on the list, a 'flood control' feature. The idea will be that you can set the max number of times in a day that a user can send emails using that form.

Because we dont allow users to enter their own messages, it's fairly unattractive to the casual abuser but could still be used to send a whole bunch of unwanted emails to some poor fella. So, in conclusion, watch this space ;)

Glad you like it, i'll post back here when i get the flood control bolted on....

Nick

Flood Control

Nick Wilson - May 8, 2004 - 09:16

Well, that didnt take long ;-)

http://83.88.179.12/emailpage.module

Nick

Installed the latest incarnation...

gde - May 8, 2004 - 11:47

Seems to work fine also with your new flood control which tells me that I reached the maximum number of emails!
Great :-)

If anybody wants to try it, it can be done here
http://dippe.info/

The "email this page" link shows up when you click the "read more" link!

Thanks for all the work, Nick

droopy - May 11, 2004 - 08:05

Thanks for all the work, Nick, it's running well. I like the extra optioins.

How does this compare to refer.module?

joe lombardo - May 11, 2004 - 10:52

After a quick read of this thread, it seems that this module is very similar to the refer module. What are the differences?

- Joe

Joe Lombardo | Drupal Services: Community-Publishing.net | FamilyTimes Online Journals

Refer

Nick Wilson - May 11, 2004 - 14:47

Not sure Joe, as refer is not ready for 4.4.0 I just dont know, I took a look at the code yesterday though from the CVS version and it appears to use an SQL table for somthing or another, cant think what...

Nick

Refer Module

joe lombardo - May 12, 2004 - 02:03

I'm running the refer.module on Familytimes.com. You can see it in action there. Here are some of the advanced features that I like:

  • When sending a page to someone, you are given the chance to post your comments to the site for others to read as well.
  • When reading a page, you can follow a link to read what others are saying about that page.
  • There is a page that shows all recent referal emails sent. This becomes a sort of 'what is hot now' page.

Best,
- Joe

Joe Lombardo | Drupal Services: Community-Publishing.net | FamilyTimes Online Journals

Refer module

droopy - May 12, 2004 - 09:28

The refer module doesn't appear to have been updated since 4.2.

New module

Jhef.Vicedo - May 14, 2004 - 02:44

I have created a similar module. You can see it on http://www.truthforce.info, though you have to register first to use this module. I think it has basic features.

Please test it and email me for comments and suggestions at jeff@digitalsolutions.ph. Thanks

emailpage envelope picture

fcandia - February 1, 2005 - 15:36

Hi Joe...great website (familytimes) I was wonderig how to set the picture properly (as in your site)...I have many problems whit the picture position (mail envelope) this jump to the next row...any advice? thank you in advanced..

---------------------------
// This var is set in the settings section under the admin/modules/emailpage section
// It shows 'email this $nodetype' or 'email this page'
$e_l_t=variable_get('emailpage_link_type', 0);
switch($type) {
case "comment":
$links[] = l(t(""), "emailpage/$node->nid".($type=='comment'?'/'.$node->cid:''), array("title" => t("Enviar email a un amigo")), NULL);
break;
case "node":
if($main && variable_get('emailpage_show_on_main', 0)) {
// if enabled, show link on teasers
$links[] = l(t("", array('%name'=>($e_l_t?$node->type:'page'))), "emailpage/$node->nid", array("title" => t("Enviar email a un amigo")), NULL);
}

case "page":
// this is for the main nav, usually displayed at the top
$links[] = l(t("", "emailpage", array("title" => t("Enviar email a un amigo")), NULL);
break;
}
return $links;
}
---------------------------

btw, my website is www.pehuen.org (spanish)

The version on drupal does not work

jasmeetc - May 30, 2004 - 10:16

The version on the drupal page http://drupal.org/project/releases failed to work for me, but the version available from your web site http://83.88.179.12/emailpage.module worked fine. I did a diff and the only differences were in _help hook. I am using drupal version 4.4.1.
The problems I saw with the version on the drupal site --
1) The name column for the module on the page http://mysite.com/admin/system/modules remained blank, though the description was filled.
2) Even after enabling the module and saving the config and then refreshing the page, the emailpage option failed to appear in the module config naviation menu.

And, thanks for writing this useful module.

Thanks!

Nick Wilson - May 31, 2004 - 07:15

That help function can be a bit of a bugger ;-)

Fixed now (i hope...) and in CVS:
http://cvs.drupal.org/viewcvs/*checkout*/contributions/modules/emailpage...

Thanks for the headsup!

Nick

Another Module for You

Nick Wilson - May 31, 2004 - 18:27

If you guys are interested, there's a very similar module here:
http://cvs.drupal.org/viewcvs/contributions/modules/link2page/

Built off of the same functionality of emailpage, it provides the html required to link to nodes on your drupal sites..

Nick

set sender email to drupal user email?

AliaK - October 6, 2004 - 15:09

hi, I've installed the emailpage module onto a drupal 4.4.0 site (apache/php4/mysql onwindows 2000) and it's working well. just wondering how I can set the sender email address in the admin page to use the email address of the drupal user, or add to the form when they are sending the page (good if emailing page whilst not logged in).

thanks
Kath

not working on another site

AliaK - October 9, 2004 - 15:32

hi again, I've installed emailpage on another site (drupal 4.5-rc/linux/apache/php4) and this time it doesn't work. I've tried setting RewriteBase / in my .htaccess and have clean urls enabled in the admin section

http://www.indienews.org/emailpage&nid=1 is the url it's trying to find. sorry, I don't understand the modrewrite system.. is there something else I should try?

I've tried the 4.4 emailpage from the downloads section and also the latest one on this email. should the 4.4 work with 4.5 as well or is this my problem?

the error in the logs (& displayed) is:
404 error: emailpage not found.

thanks in advance
Kath

Page Not Found

silencespks - October 23, 2004 - 01:39

I just upgraded from 4.42 to 4.5 and now I get 'Page Not Found' is there an upgrade in the works for your module, I hope so it is a very valuable module :) Hope to hear an update soon. Heather

Email page fun and games....

Nick Wilson - October 24, 2004 - 16:08

Hi guys,

Sorry but the emailpage module is NOT 4.5 compatable. I have it ready for CVS upload though thanks to a kindly drupal user and will get that done today or tomorrow morning latest...

;-)

Nick

great Nick..

silencespks - October 27, 2004 - 19:58

can't wait to see the 4.5 release:)

Heather

Website version blew up

garym@teledyn.com - October 24, 2004 - 17:00

I got the famous memory-error using the edition from your website with the latest CVS 4.5+:

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in /var/www/html/themes/c_medpage/page.tpl.php on line 189

This normally means something else went wrong ... the offending line in our phptemplate-based page module is just the test to see if the sidebar has any contents.

There's no version mark on this one: 8283 May 8 05:20 emailpage.module

Is it the same as this one?

gde - October 24, 2004 - 17:50

/* $Id: emailpage.module,v 1.1.2.3 2004/05/31 14:40:47 nick Exp $ */

Cheers

Good point ...

garym@teledyn.com - October 24, 2004 - 18:29

Hadn't thought to check the timestamps ... if these editions are from May, then it's highly unlikely they've been updated to work with 4.5.

Correct.

Nick Wilson - October 24, 2004 - 19:09

Just disable it guys, i'd forgotten all about this thread, it was posted as i didnt know how to commit a module to cvs at the time ;) the version on my 'site' is *very* old. There's no way it'll work with 4.5 and neither will the 4.4 version.

Just bear with me please, i will have it up by absolute latest this time tommorow but hopefully this eveningi if I can work out how to commit it to CVS again LoL!

I'll post in this thread when it is available in CVS ok?

thanks..

Nick

Please do since...

gde - October 24, 2004 - 20:01

it is very useful. I have something similar at a site at the university (not Drupal powered though) and visitors seem to love being able to quickly send a message to a friend or colleague.
Cheers

Done!

Nick Wilson - October 25, 2004 - 06:01

http://cvs.drupal.org/viewcvs/contributions/modules/emailpage/

It'll be in the main downloads page soon i guess, for now, you can grab it from the above link.

There shouldnt be any bugs, but if you find any, please use the bug report system as i rarely check the forums these days..

thanks for your patience guys,

Nick

small comments

Bèr Kessels - October 25, 2004 - 08:07

Nick,

I looked at it, and have some small comments:
why do you not use Drupals error handling? http://drupaldocs.org/api/head/function/drupal_set_message
why do you use emailpage&nid=$node->nid&cid=$node->cid urls and not
emailpage/$node->nid/$node->cid and then collect the variables using the drupal method $nid = arg(1) and $cid = arg(2) on the pace you need it?

And last: An email collector would be nice. It can be used for evil purposes, but it would not be a bad idea :)
And very last: Another cool feature would be to use a from address. That should be prefilled with the uses addy if he she is registered.

[Ber | Drupal Services webschuur.com]

error handling

Nick Wilson - October 25, 2004 - 11:14

>>error handling

All of that stuff is not in there becasue I didnt update the module, ive been swamed with work on http://www.threadwatch.org and just havnt had enough hours in the day despite giving up drinking so im not spendig weekend mornings hungover hehe...

anythng that i neglected to do in the original 4.4 was due to ingnorance, nothing more. If anyone wants to create patches I will certainly update it, but for the next few weeks i just cant spare a minute :)

>>email catcher

Nope, i simply will not build that :) - it's worse than evil...

go Nick...

silencespks - October 27, 2004 - 20:09

Well you certainly have a good excuse... sober first :) module later ;) Thanks for the update.

thanks for your quick respons

AliaK - October 28, 2004 - 06:05

thanks for your quick response!! I'll try it out when I get back to the UK. yeah adding a 'from' field would be the only addition I could think of if anyone does have time.

cheers
Kath

Talking of patches...

clockwerx@www.s... - November 28, 2004 - 23:58

... There's this one...

Link in email doesn't work

wdrupal - January 29, 2006 - 11:17

I'm using emailpage module on Drupal 4.6 (Civicspace), and also have the pathauto module installed.

Everything works except the link in the email.

The actual URL of a node will be something like http://www.my_site.com/the_title_of_the_story, but the link in the email will be something like http://www.my_site.com/node/view/2, and will just link to a blank page.

I've seen this on two sites already.

Page not found on drupal 4.7

poorhouse - February 25, 2006 - 19:13

Hi,

Looking forward to using this module! Have tried both the 4.7 and the CVS release of this module and am having problems. When enabled, all the links appear fine in the correct places, but when a user clicks on the "Email this page" link they get "Page not found" on every one.

The web browser (Firefox or IE) that they have tried to go to the address

www.example.com/?q=emailpage%26nid%3D31

for instance

I wonder if it is anything to do with cleanurls? I do not have them enabled, but from the above discussion it looks like it should still work? I've examined the settings and searched for assistance but can't see what I'm doing wrong!

Thanks in advance for any help.

I have tried this modules.

xlitang - May 24, 2006 - 17:10

I have tried this modules. When I come to Administer-->Settings-->emailpage, I got something as

below:

emailpage
Array (buttons)Save configuration Reset to defaults.

Basically, this page for settings of emailpage is not working. Please help.

Download link

litebulb1 - December 6, 2007 - 01:00

The download link does not seem to be working. Is there another one?

Life Blog | Data Transferring | Song Analysis

Old

Michelle - December 6, 2007 - 01:09

This post is 3.5 years old. Even if the link worked, the module would be extremely outdated. If you're looking for one you can use, try the "forward" module.

Michelle

--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.

 
 

Drupal is a registered trademark of Dries Buytaert.