Hello Karin, 

On Sun, 27 May 2001 at 15:51:43 [GMT +0200], you wrote:
>> I saw some mails on how to automatically get text into the body of
>> the message using the mailto: URL; is it also possible to add
>> custom headers to a message this way?

KS> Yes:
KS> mailto:[EMAIL PROTECTED]?subject=X%20Y&body=Z
KS> will create a mail addressed to [EMAIL PROTECTED]
KS> with the subject:  X Y
KS> and in the body:   Z
KS> Don't use spaces, use %20 instead.

Here's an article I wrote for my newsletter a while back concerning
the whole mailto voodoo issue.. Hope it helps.

5. Tips, Tricks, Do's and Don't Do's
------

                        Fun with mailto

Usually when you run across a mailto link, it's just the plain-jane
basic syntax of <mailto:[EMAIL PROTECTED]>. What many people don't
know, is that the mailto URL has quite a bit of flexibility and will
allow you to create complex hyperlinks. 

A few of the main uses I have for complex mailto URLs is for
subscription and unsubscription from the PCWize newsletter, e-mail
handling and filtering, as well as requests for information such as
past editions and my public PGP key.

Let's start off with the basics and then we'll get into examples.

To create a valid mailto URL with all of its functionality, you must
use the syntax "mailto:"; (without the quotes.) For example:

mailto:[EMAIL PROTECTED] is considered the correct way to include a
mailto URL, but most e-mail applications and WYSIWYG HTML editors will
recognize just an e-mail address like [EMAIL PROTECTED] However, to
create complex mailto URLS, you will need to use the prefix "mailto:";.

mailto:[EMAIL PROTECTED]?Subject=This_Whole_Thing_Is_Clickable

whereas the below is not:
[EMAIL PROTECTED]?Subject=This_Didn't_Work

I didn't test these in all the e-mail applications out there, so some
of them may actually recognize the above "bad" example. If it did,
great, if it didn't, then your e-mail software follows the standards,
and you really have nothing to worry about.

The first thing you probably noticed in the above "good" example is
the use of the "?", "Subject=", and "_" in the URL. The first two are
required, while the latter is a personal preference of mine.

A "?" is used to separate "header fields", while the "=" sign follows
the header name you wish to define. Here's another example:

mailto:[EMAIL PROTECTED]?Subject=Message_subject&Body=Message%20Body

In this example, I've defined not only a Subject, but the Body as
well. Notice the use of the ampersand between the different message
header fields (Subject & Body). Any time you want to define an
additional header field, you must use the ampersand.

So what are those "%20" thingys? That is the ASCII code for a space.
See, a URL cannot contain any spaces by standard. There is good reason
for this, because if you forgot to encapsulate the URL, then all the
text that follows your URL would become part of the URL. Let me show
you what I mean.

mailto:[EMAIL PROTECTED]?Subject=Message subject.

Notice that the word "subject" is not included as part of the URL.
Even if I encapsulate the URL like this:

<mailto:[EMAIL PROTECTED]?Subject=Message subject>, it won't work.
Personally, I think that encapuslated URLs should work, but oh well.
The reason-- as I stated earlier --is so that following text won't be
considered part of the URL by mistake. For example:

If you'd like to see my picture, then click the following link
mailto:[EMAIL PROTECTED]?Subject=Get%20my%20pic which you will only
need to click the send button once the message window pops up.

If URLs allowed spaces, then *everything* after the "%20pic" would
become part of the Subject. Definitely a bad thing!

There are other numbers you can put after the percent sign to do
different things. If you have a handy dandy ASCII code chart laying
around, you can use pretty much anything on it. However I won't vouch
for what will happen if you try to NULL something.

ASCII codes can come in quite handy at times as evidenced by this
example: <mailto:[EMAIL PROTECTED]?Body=Line1%0D%0ALine2> Pretty nifty
huh! 

 %0A is a Line Feed
 %0D is a Carriage Return
 %2C is a ,
 %2E is a .
 %3C is a <
 %3D is a =
 %3E is a >
 %3F is a ?
 %40 is a @

Why did I tell you all of those? <grin> For obfuscated mailto URLs of
course! I mean, if you're gonna geek out with me, you might as well go
all the way!

<mailto:%65%64%69%74%6F%72%40pcwize%2Ecom%2C%20smbdyelse%40pcwize%2Ecom>

Now is that ugly or what? It still works, but is not readily human
readable.

Speaking of which, the use of ASCII codes in place of your e-mail
address is an effective way to keep your e-mail address hidden from
all but the most sophisticated of e-mail address harvesting
spiderbots that spammers use.

I had mentioned at the beginning, that I often use complex mailto URLs
to facilitate e-mail filtering. When most of you subscribed to PCWize,
you clicked on a link something like this:

<mailto:[EMAIL PROTECTED]?Subject=Subscribe_PCWize&Body=Just_Click_Send>

On my end, I looked for the Recipient to equal "[EMAIL PROTECTED]",
and the Subject to equal "Subscribe_PCWize". If both of these
conditions were met, then you became a new subscriber. So why did I
define the Body to contain the text "Just_Click_Send"? Well, not many
people use complex URLs (not including forms), so before I put that
text in there, I had people writing all sorts of stuff in the message
Body to try and subscribe. This didn't affect my mail filtering one
iota, but I was trying to save people from typing in stuff that they
really didn't need to.

You might have noticed by now that I tend to use the underscore
character as opposed to the "%20" to separate my text. This is really
just a habit as opposed to any real reason. However, I did use some
oddball e-mail programs-- back when I was but a young pup --that didn't
recognize the "%20", so I used the underscore. I also thought it
looked much nicer (readability-wise.)

<mailto:[EMAIL PROTECTED]?Subject=This%20is%20hard%20to%20read>
<mailto:[EMAIL PROTECTED]?Subject=This_is_easy_to_read>


Ok, so now we know pretty much all the cool stuff there is to know
about complex mailto URLs. Here's what fields you can define:

TO      = <mailto:[EMAIL PROTECTED]?[EMAIL PROTECTED]>
CC      = <mailto:[EMAIL PROTECTED]?[EMAIL PROTECTED]>
Subject = <mailto:[EMAIL PROTECTED]?[EMAIL PROTECTED]>
Body    = <mailto:[EMAIL PROTECTED]?[EMAIL PROTECTED]>

      Just a note concerning the placement of a mailto URL in the
      subject or body; I said above, that you should always
      encapsulate a URL with "<" and ">". However the below won't
      work: 

      <mailto:[EMAIL PROTECTED]?Body=<[EMAIL PROTECTED]>>, so
      you will have to use the ASCII code for them as below:

      <mailto:[EMAIL PROTECTED]?[EMAIL PROTECTED]%3E>


Well, that's it! I know it was long, but hopefully interesting. Now,
you all know that I wouldn't let you go without a real-world usage of
complex mailto URLs, so here it is:

Would you like to see an equally in-depth article on URLs for other
things like HTTP, Gopher, FTP, Usenet etc? If so, click below and
make your vote heard:

<mailto:%65%64%69%74%6F%72%40pcwize%2Ecom?Subject=%59%45%53%21>



Cheers,
Leif Gregory 

--  
PCWize Editor  /  ICQ 216395  /  PGP Key ID 0x7CD4926F
Web Site <http://www.PCWize.com>
TB FAQ   <http://www.silverstones.com/thebat/FAQ.html>

Using The Bat! 1.53 Beta/8 under Windows 98 4.10 Build 2222 A  
on a Pentium III 500 MHz notebook with 256MB.

Tagline of the day:
Wasn't abused as a child, but should have been. 


NetZero Platinum
No Banner Ads and Unlimited Access
Sign Up Today - Only $9.95 per month!
http://www.netzero.net
-- 
______________________________________________________
Archives   : <http://tbudl.thebat.dutaint.com>
Moderators : <mailto:[EMAIL PROTECTED]>
TBTech List: <mailto:[EMAIL PROTECTED]>
Unsubscribe: <mailto:[EMAIL PROTECTED]>

You are subscribed as : archive@jab.org


Reply via email to