Tags:
create new tag
, view all tags

Summary

Lots of people want the ability to click on a link to send a page to someone the reader specifies.

Of course, cutting and pasting is always an option.

Creating links with mailto: is the generic way. Such links can specify the person to whom the mail is to be sent, or can be left "open" to allow the reader to specify any recipient. mailto llinks can be embedded in HTTP URLs, or using the double square bracket notation.

Such links can be specified as TWiki "variables", e.g.

      * Set MAILTHISTOPIC = [[mailto:?subject=%WIKITOOLNAME%:%WEB%.%BASETOPIC%&body=%TOPICURL% %MAILTHISTOPICTEXT%]]
and can be placed in site preferences, templates, etc. %MAILTHISTOPIC% is part of the standard TWiki release.

Justification of Summary

I (AndyGlew) spent the better part of this afternoon reading through various pages related to email, WebNotify, etc. I spent more than three hours looking, and have used TWiki for several years, and I did not know about =%MAILTHISTOPIC% until just now.

I.e. I, at least, find the interaction of email and TWiki confusing.

Some sort of summary is needed. This just a start.

(I've also added a new question at the end.)

History - Discussion Mode

If I want to send a page to someone, I can copy its content and paste it into an HTML email but this is a bit clunky. What I'd like is a link or form on the page to email it to one or more people. A skin such as 'print' could be automatically applied to the page to remove unwanted clutter.

-- NigelArmstrong - 26 Mar 2002

It's simplest just to send a link to the page - try this bookmarklet (paste it into your browser URL bar, or embed in an A HREF link):

javascript:location.href='mailto:?SUBJECT='+document.title+'&BODY='+escape(location.href)+'?skin=print'

Try Google:bookmarklet for more JavaScript stuff. Non-JavaScript approaches would work across more browsers but are probably harder to do, requiring TWiki server side code.

-- RichardDonkin - 26 Mar 2002

The non-JavaScript link would be <a href="mailto:?SUBJECT=%BASETOPIC%&BODY=%SCRIPTURL%/view/%WEB%/%BASETOPIC%">Send a link to this page to a friend!</a> .
Test: Send a link to this page to a friend!

Note that this won't work on Windows installations where the view script was renamed to view.pl .

  • Have fixed this above by adding %SCRIPTSUFFIX% - [ RichardDonkin ]

Also, the double-square-bracket notation doesn't seem to work with mailto: URLs, at least I couldn't make TWiki interpret it as I wanted it to. (The mailto: URL used here is atypical because it intentionally omits the actual target address, to be filled out by .)

TO DO (IMHO):

  1. A new %SCRIPTNAME% variable in TWiki.
  2. Add mailto: to the list of protocol prefixed recognized by the double square bracket syntax.

-- JoachimDurchholz - 27 Mar 2002

The first issue is not a problem, see revised URLs above.

The issue about mailto: and [[ notation has come up before at MailtoWithSubject, so... I had a quick hack at this, and came up with the following syntax to generate almost any mailto link, based on EasierExternalLinking:

[[mailto:fred@example.com?BODY=%SCRIPTURL%/view%SCRIPTSUFFIX%/%WEB%/%BASETOPIC% Send a link to this page]]

[[mailto:?subject=%BASETOPIC%&body=%SCRIPTURL%/view%SCRIPTSUFFIX%/%WEB%/%BASETOPIC% Send a link to this page]]

[[mailto:fred@example.com?SUBJECT=foo Send email about foo]]

[[mailto:?SUBJECT=foo%20bar Send email about 'foo bar']]

Note the use of %20 for space in the mailto: link - other characters that may require URL-encoding are listed on this page.

I've attached a patch that implements this - have a test of this and see how it goes (use patch -i patchfile to apply this on Unix or CygWin). Worked well for me, with IE/Opera (using Outlook) and Mozilla (using built-in email client).

FIXME: The security of this patch needs thinking about, as it's a lot less restrictive about what is allowed after a 'mailto' - in fact the whole string after the '?' should be URL encoded.

What would also be useful is a http://twiki.org/cgi-bin/view/Codev/EmailThisPageLink variable that replaces the URLs included above - this can be created in TWikiPreferences etc by doing:

   * URL for current topic
      * Set TOPICURL = %SCRIPTURL%/view%SCRIPTSUFFIX%/%WEB%/%BASETOPIC%

This then lets you just write

[[mailto:?subject=%BASETOPIC%&body=%TOPICURL% Send a link to this page]]

And of course you can do the following, letting you write Send a link to this page in templates or whatever:

   * 'Mail this page' link
      * Set MAILTHISPAGE = [[mailto:?subject=%BASETOPIC%&body=%TOPICURL% Send a link to this page]]

This all makes it a lot easier to do mailto: links, so I'll probably commit this to the TWikiAlphaRelease soon.

-- RichardDonkin - 28 Mar 2002

It will be great to be able to email link to current page - InstantNotification on demand.

Some of us (I cannot say "we" smile ) recently considered using consistently page instead of topic (see TWikiGlossary). NObody complained yet. And it looks like Richard sometime prefers page, too.

I do not propose to rename existing TWikiVariables (yet smile ), but maybe we can call new variable PAGEURL instead of TOPICURL.

-- PeterMasiar - 28 Mar 2002

Now in TWikiAlphaRelease

-- RichardDonkin - 28 Mar 2002

Now that TWikiAlphaRelease is implemented on TWiki.org, you can try using these improved mailto: links - see Sandbox.RichardsPage.

-- RichardDonkin - 05 Apr 2002

I've updated TWikiPreferences on TWiki.org, so you can now write %MAILTHISTOPIC% to generate this: Send a link to this page. The link text can be customised with a separate variable. It might be useful to include this sort of link in TWikiSkins, or even the default templates - skins can do image-based links by using the underlying mailto: link feature.

-- RichardDonkin - 13 Apr 2002

Set this back to under construction, since security needs looking at.

-- RichardDonkin - 04 May 2002

I prefer:

      * Set MAILTHISTOPIC = [[mailto:?subject=%WIKITOOLNAME%:%WEB%.%BASETOPIC%&amp;body=%TOPICURL% %MAILTHISTOPICTEXT%]]

As it retains the context and brand of which Wiki it is on. I agree it would be useful to get this into the Skin layer - perhaps a consideration for TWikiSkinMaster?

(Problem with this: any setting of WIKITOOLNAME in TWikiPreferences is ignored for this, even though this usage occurs after the setting in the page. Wierd.)

-- MartinCleaver - 13 Apr 2003

Also, would be useful if this was implemented soley server side instead of relying on the email client. Many of my users use webmail so mailto: links don't work.

-- MartinCleaver - 03 Jun 2003

Good idea. I use webmail and I'll love it. Twiki.org can send WebNotify - can we have something like that in parallel? Like file .emailthis with list of pages and emails to send to, and have a cron job say once every hour to run through and email what accumulated? I guess now having OO Twiki would make it much easier to add this feature...

-- PeterMasiar - 03 Jun 2003

I took the liberty of adding a summary at the top. I've spent the better part of the afternoon figuring out various aspects of the TWiki/mail interaction: wading through all of these discussion mode pages is a pain.

Now, a question:

I understand how to use mailto to create a link to send mail

  • to users specified in the topic page/link
  • to users that the reader (who has clicked on the link) will specify.
Q: is there a way to:
  • send mail to users who have registered their interest in the page (or web)
I.e. to have reader or writer specified "Push this page to registered users now"?

There seems to be a cross-product of notification techniques

Warning: Can't find topic Codev.Cross-productOfNotificationTechniques

-- AndyGlew - 24 Jun 2003

The basic linking syntax is documented at TextFormattingRules#TWiki_Editing_Shorthand near the end - perhaps it should be put under external links, but the docs are there. MAILTHISTOPIC is in TWikiPreferences, but it's just a variable setting (i.e. no core code needed to support this), so there's nothing hidden in the code - again, the docs could be improved, so that people can go to TWiki:TWiki not the Codev pages for docs.

Improved reviewing and editing of TWiki docs would catch cases where an edit is perhaps not in the right place.

-- RichardDonkin - 16 Jul 2003

Queuing this for server-side implementation for Edinburgh.

-- MartinCleaver - 10 Nov 2005


Category: TWikiPatches
Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatpatch EmailThisPageLink.patch r1 manage 2.0 K 2002-03-27 - 15:59 RichardDonkin Patch for improved mailto links
Edit | Attach | Watch | Print version | History: r22 < r21 < r20 < r19 < r18 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r22 - 2006-04-29 - SamHasler
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.