Jump to content

Email script/Javascript help


ShaolinF

Recommended Posts

Hi Guys,

 

I've made a email script to include javascript. Now what I want to do, is that I want to hide the link in status bar when I hover over it. I've implemented javascript into the code but I keep getting the following error:

 

Parse error: syntax error, unexpected T_STRING in /home/****/public_html/fbmail/contact.php on line 12

 

Here is line 12:

$message .= '<a href="http://www.mysite.com/" onMouseOver="window.status='Click here to continue.'; return true;" onMouseOut="window.status=''; ">Click here to continue ..</a>';

 

The complete code is as follows:

 

$to = "Username <email@domain.com>"; 
$subject = "Thank you for your email";
$headers = "From: Sender <email@domain.com>\n";
$headers .= "MIME-Version: 1.0\n"; 
$headers .= "Content-type: text/html; charset=iso-8859-1\n"; 
$headers .= "Reply-To: Sender <email@domain.com>\n"; 
$headers .= "X-Priority: 1\n"; 
$headers .= "X-MSmail-Priority: High\n"; 
$headers .= "X-mailer: My mailer"; 

$message .= '<a href="http://www.mysite.com/" onMouseOver="window.status='Click here to continue.'; return true;" onMouseOut="window.status=''; ">Click here to continue ..</a>';

mail ($to, $subject, $message, $headers) 

Link to comment
Share on other sites

Try this:

$message .= '<a href="http://www.mysite.com/" onMouseOver="window.status=\'Click here to continue.\'; return true;" onMouseOut="window.status=\'\'; ">Click here to continue ..</a>';

 

You need to escape the single quotes used in the JS part.

Link to comment
Share on other sites

Try this:

$message .= '<a href="http://www.mysite.com/" onMouseOver="window.status=\'Click here to continue.\'; return true;" onMouseOut="window.status=\'\'; ">Click here to continue ..</a>';

 

You need to escape the single quotes used in the JS part.

 

Thanks. Although that works when I send the email to my address the link is still visible in the status bar.. When the mouse hovers over the link it should say "Click here to continue".

Link to comment
Share on other sites

Try this:

$message .= '<a href="http://www.mysite.com/" onMouseOver="window.status=\'Click here to continue.\'; return true;" onMouseOut="window.status=\'\'; ">Click here to continue ..</a>';

 

You need to escape the single quotes used in the JS part.

 

Thanks. Although that works when I send the email to my address the link is still visible in the status bar.. When the mouse hovers over the link it should say "Click here to continue".

 

You do know that most email clients disallow javascript in the email that is received right? Reason being is because javascript can easily be used to exploit someone's computer.

 

I doubt this would/should work.

Link to comment
Share on other sites

Highly doubt it, but give it a try.

 

You have to know that most email clients filter out that stuff or display it as just raw text for that exact reason. I could hi-jack anyone's cookies using javascript/iframe. Which is why it would, and should be disabled.

 

I think your going to be wasting your time pursuing this any further.

Link to comment
Share on other sites

Anyway, is it really important to hide the location of the link?

 

Even when I receive emails from friends that contain links I never click blindly on them - I always check the URL first and if it looks suspicious I check it with a script I wrote and reads the website and shows me what I could be accessing.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.