Page 1 of 1

Email Tracking/Dynamic Emails?

Posted: Tue Aug 21, 2007 12:38 am
by kkonline
***** ONLY ONE POST PER QUESTION. DO NOT DOUBLE POST. ****

Is there any way of email tracking or sending dynamic emails?

What i mean is > if i want to send a php code in an email such
that whenever the user opens the email he sees the CURRENT DATE
AND TIME.

Or When i post a newsletter, i should get to know the email id
if not then atleast the ip addresses and the number of people
till now who have opened the mail. That means whenever someone
opens an email, the counter should be incremented and displayed
on the email itself or on my server

I want to send php function/code in the email which executes
as it does on my server and not just display the code as text part of the mail

If I have $value=6++;

then if i write echo $value;
It should print 6 on the email for the first time and then increment
and show 7, 8... whenever that mail is opened next..

Posted: Tue Aug 21, 2007 12:41 am
by s.dot
It's not really possible unless you do it in some sort of hackish way. Such as images.

Code: Select all

<img src="http://www.example.com/script.php?emailId=1" />
Then again, a lot of mail programs have images off (even by default) and a lot of people don't accept HTML emails.

Posted: Tue Aug 21, 2007 2:03 am
by kkonline
scottayy wrote:It's not really possible unless you do it in some sort of hackish way. Such as images.

Code: Select all

<img src="http://www.example.com/script.php?emailId=1" />
Then again, a lot of mail programs have images off (even by default) and a lot of people don't accept HTML emails.
I got the point that if the email is html formatted then i can do the above thing. But not getting how to implement script.php?email=number part. can you give more details or better share a code similar to it's functionality. I want to track the email ids and ip who have read the newsletter and at what time?

Posted: Tue Aug 21, 2007 2:37 am
by onion2k
kkonline wrote: I got the point that if the email is html formatted then i can do the above thing. But not getting how to implement script.php?email=number part. can you give more details or better share a code similar to it's functionality. I want to track the email ids and ip who have read the newsletter and at what time?
It'd just be a script that records the id from the $_GET array and the IP from $_SERVER. You're wasting your time though, I reckon as few as 10% of people view images in emails. No major mail clients or web mail services display them automatically. Any records you get are going to be completely inadequate. Accurately tracking email is impossible.

The best way forward is to send the user a very vague email that tempts them to your website via a special link or URL. Then you can track the pageviews in the normal way.

Posted: Tue Aug 21, 2007 3:48 am
by kkonline
I used the following code for email.php.
and when i wrote http://mysite.com/track/email.php?userid=111
I got the image but no entry in the database ? What could be the reason?

Code: Select all

<?php
$con = mysql_connect("localhost","user","pass");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("sqldb", $con);

$userid = $_GET['userid'];

$sql="INSERT INTO quote (contributed_by)
VALUES
('$_GET[userid]')";

mysql_close($con);
?>
<img src="http://mysite.com/gallery/mj_1.jpg">
also is there any way i can increment the userid on it's own rather than sending userid=1 to 1st email and userid=2 to second email if i have around 100 emails; i just want an entry in the data base how all the id's that have viewed?

Posted: Tue Aug 21, 2007 4:00 am
by iknownothing
lack of mysql_query is why it didnt input into the database.

To make it automatically count up, you would first have to select from the database, use $userid++ (or similar) and then insert the new data.