Problem with HTML email with Javascript
Moderator: General Moderators
-
windforceus
- Forum Newbie
- Posts: 23
- Joined: Tue Mar 15, 2005 12:40 pm
Problem with HTML email with Javascript
Hi All
I am using php script to send html email with javascript. It work fine in outlook but when i send to yahoo and hotmail. What i see from yahoo is my html email with javascript plain text. I think yahoo convert my javascript to plain text in the email.
Is there anyway to make an html email and javascript effect work in yahoo?
Please help!! this is urgent
Ray
I am using php script to send html email with javascript. It work fine in outlook but when i send to yahoo and hotmail. What i see from yahoo is my html email with javascript plain text. I think yahoo convert my javascript to plain text in the email.
Is there anyway to make an html email and javascript effect work in yahoo?
Please help!! this is urgent
Ray
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
-
windforceus
- Forum Newbie
- Posts: 23
- Joined: Tue Mar 15, 2005 12:40 pm
Thanks for reply
I am researching to get response from client when he/she open the email for marketing purpose. I don't intend to hack people's computer. Here is the simplied code:
feyd | Please use
Code: Select all
<?php
//session_start();
require_once("db_cns.php");
require_once("htmlMimeMail5/htmlMimeMail5/htmlMimeMail5.php");
$text2 = "
<html>
<head>
<title>Untitled</title>
<script language=\"JavaScript\" type=\"text/javascript\">
window.onload = function () {
var today = new Date();
var expire = new Date();
var cookieValue=\"1\";
var name =\"view1\";
var cookieFound = 0;
var start = 0;
var end = 0;
var CookieString = document.cookie;
var myvar;
var i =0;
while (i <= CookieString.length) {
start = i;
end = start + name.length;
if (CookieString.substring(start,end) == name) {
cookieFound = true;
break;
}
i++;
}
if (cookieFound==false) {
expire.setTime(today.getTime() + 3600000*24*1);
document.directForm.submit();
}
}
</script>
</head>
<body >
HTML
<FORM
NAME=\"directForm\"
ACTION=\"http://localhost/email/email/test.php\"
METHOD=\"get\"
ENCTYPE=\"multipart/form-data\">
<input type=\"hidden\" name=\"cid\" value=\"1000\">
</form>
</body>
</html>
";
// Instantiate a new HTML Mime Mail object
$mail = new htmlMimeMail5();
// Set the sender address
// $mail->setFrom("rayh@ablecomp.com");
$mail->setFrom("email");
// Set the reply-to address
$mail->setReturnPath("email");
// Set the mail subject
$mail->setSubject("Test HTML Mime Mail");
// Set the mail body text
$mail->setText("HELL0");
// Create the HTML email
$mail->setHTML($text2);
// Send the email!
$mail->send(array("email"));feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
use an image to track when they opened the file. The cookie information, if they are viewing it on Yahoo, will tell you Yahoo's cookie information. Not your own.
Alternately, you can give people a plain-text version with a link to a nice prettified version, unique to them if need be.
I'd be surprised if outlook's works correctly.. not to mention your Javascript code may easily produce a false positive because 'view1' may appear almost anywhere inside the cookie data.
Alternately, you can give people a plain-text version with a link to a nice prettified version, unique to them if need be.
I'd be surprised if outlook's works correctly.. not to mention your Javascript code may easily produce a false positive because 'view1' may appear almost anywhere inside the cookie data.
-
windforceus
- Forum Newbie
- Posts: 23
- Joined: Tue Mar 15, 2005 12:40 pm
Thanks for reply
THe cookie name will be reconsidered , thanks. It is the test version. Besides cookie, anyway we can trace the response? I am looking for the automatic loading way because users may not want to click the link then it will result the incorrecness.
-
windforceus
- Forum Newbie
- Posts: 23
- Joined: Tue Mar 15, 2005 12:40 pm
Image?
Can you be more specific? How to use image to trace it?
-
windforceus
- Forum Newbie
- Posts: 23
- Joined: Tue Mar 15, 2005 12:40 pm
a popout window with image?
just a guess
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
-
windforceus
- Forum Newbie
- Posts: 23
- Joined: Tue Mar 15, 2005 12:40 pm
ahh..
I can do programming in php which will make this easiler. However, I can only do this in html file. That is what my boss is asking...He want to trace people reading his ad html. Thanks for the advice...hope someone can help me....
-
windforceus
- Forum Newbie
- Posts: 23
- Joined: Tue Mar 15, 2005 12:40 pm
To feyd
"an image with trackable data that requests from your client's site. "?
Say we have an image in html file. How did you put an trackable data in client site? My understanding is storing images in the server and puting image links in the htm email. When the email is open, it will load image from our server. Then we can use php script to store the times? Perhaps i am wrong or...sorry i am a newbie.
Ray
Say we have an image in html file. How did you put an trackable data in client site? My understanding is storing images in the server and puting image links in the htm email. When the email is open, it will load image from our server. Then we can use php script to store the times? Perhaps i am wrong or...sorry i am a newbie.
Ray
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
Oh... then the image idea is what you should do. Here's a sample.
Inside the HTML email mesage, you have this:
then,
Inside the HTML email mesage, you have this:
Code: Select all
<img src="e;http://www.yourdomain.com/dump/track.php?userid=234810"e; />Code: Select all
<?php
$id = is_numeric($_GETї'userid']) $_GETї'userid'] ? null;
session_start();
header('Content-type: image/jpeg');
$image = imagecreatefromjpeg("e;Path to jpeg you want to show up as a picture"e;);
imagejpeg($image);
//And then logging: (ripped this code off http://www.phpfreaks.com/tutorials/22/0.php )
if(!session_is_registered('counted')){
$agent = $_SERVERї'HTTP_USER_AGENT'];
$uri = $_SERVERї'REQUEST_URI'];
$user = $_SERVERї'PHP_AUTH_USER'];
$ip = $_SERVERї'REMOTE_ADDR'];
$ref = $_SERVERї'HTTP_REFERER'];
$dtime = date('r');
if($ref == "e;"e;){
$ref = "e;None"e;;
}
if($user == "e;"e;){
$user = "e;None"e;;
}
$entry_line = "e;$dtime - IP: $ip | Agent: $agent | URL: $uri | Referrer: $ref | Username: $user | Userid: $id \n"e;;
$fp = fopen("e;logs.txt"e;, "e;a"e;);
fputs($fp, $entry_line);
fclose($fp);
session_register('counted');
}
?>
Last edited by Ambush Commander on Tue Mar 15, 2005 6:07 pm, edited 1 time in total.
-
windforceus
- Forum Newbie
- Posts: 23
- Joined: Tue Mar 15, 2005 12:40 pm
Ambush
You are using session in an html file? Is it possible for yahoo.mail showing the compiled php code in html email? Thanks for the idea.
Ray
Ray