Question: mask url of links inside an email

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
jeboy25
Forum Newbie
Posts: 11
Joined: Mon Mar 24, 2008 2:15 am

Question: mask url of links inside an email

Post by jeboy25 »

Is it possible to mask the url of links inside an email?

e.g.
the url is: http://www.domain.com/contact.php?id=2&name=john

but will display as: http://domain.com/contact.php only when the mouse pointer hovers the link
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Question: mask url of links inside an email

Post by Chris Corbyn »

Send the email in HTML format?
jeboy25
Forum Newbie
Posts: 11
Joined: Mon Mar 24, 2008 2:15 am

Re: Question: mask url of links inside an email

Post by jeboy25 »

yes its an html format
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Question: mask url of links inside an email

Post by Chris Corbyn »

I'm not sure what you're asking then?

Code: Select all

<a href="http://server.tld/?foo=bar">http://server.tld</a>
?
jeboy25
Forum Newbie
Posts: 11
Joined: Mon Mar 24, 2008 2:15 am

Re: Question: mask url of links inside an email

Post by jeboy25 »

What I mean is, the actual url of the link for example is http://www.domain.com/contact.php?id=2&name=john but I want it to be displayed as http://www.domain.com/contact.php only when the recipient mouse over the link.

In outlook 2007, when you mouse over or hover a link inside an email, it will display the target url of that link. So what I would like to achieve is when the recipient mouse over a link in my email it will display the url http://www.domain.com/contact.php instead of http://www.domain.com/contact.php?id=2&name=john which is the true url
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Question: mask url of links inside an email

Post by Chris Corbyn »

Hmm... sounds fishy 8O

The short answer is no, unless email clients have started allowing the use of JavaScript and implement the window features as fully as a browser would. If all you're worried about is how clean the URL looks then you can use a redirect.... however, the thing that jumps to mind when someone asks something like this is "phishing" which I seriously hope you're not ;)
jeboy25
Forum Newbie
Posts: 11
Joined: Mon Mar 24, 2008 2:15 am

Re: Question: mask url of links inside an email

Post by jeboy25 »

Yeah I know exactly what you mean. Actually theres no problem with our current url which has parameters, its just our boss wants to display the url to the subscriber with no parameters because he thinks that maybe the subscriber will get intimidated to click it if he see a parameters in the url of the links inside our email to him. I know that javascript is not allowed in email clients. I also strongly disagree to phishing activities.
xdecock
Forum Commoner
Posts: 37
Joined: Tue Mar 18, 2008 8:16 am

Re: Question: mask url of links inside an email

Post by xdecock »

maybe you can use mod_rewrite to provides url like this:

http://www.domain.com/m/2/john/contact.php

With a rewriteRule like this:
rewriteRule /m/([0-9]+)/([a-zA-Z0-9]+)/contact.php contact.php?id=$1&name=$2

(I didn't tested it, it can be improved, but it's a base)

PS: the /m/ is to start the url with a specific folder (m for mailing here)

[edit: corrected typo]
jeboy25
Forum Newbie
Posts: 11
Joined: Mon Mar 24, 2008 2:15 am

Re: Question: mask url of links inside an email

Post by jeboy25 »

xdecock, how can I do mod_rewrite? remember that its a hyperlink inside an email.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Question: mask url of links inside an email

Post by Chris Corbyn »

jeboy25 wrote:xdecock, how can I do mod_rewrite? remember that its a hyperlink inside an email.
You put the clean hyperlink in the email and handle the rewrite at a server level. The same way you do it in a web application.
dillion
Forum Commoner
Posts: 56
Joined: Thu Feb 15, 2007 8:32 am

Re: Question: mask url of links inside an email

Post by dillion »

Why not replace the link with something less "personal" so the user is not intimated, e.g.

http://www.domain.com/contact.php?i=2&n=u2gkhk12 (using less obvious parameter variables and encryption).

Or use:
http://www.domain.com/redirect.php?i=uihkuhk22hi12979 (which based on the i value, redirects to contact page and display relevant details on contact page)
Post Reply