View Full Version : mail opened?
etron
Sun 4th Jan '04, 9:23pm
hi everyone ...
i would like to ask if there is any possible ways that i can know the emails that i have sent out ... have been opened by the recipient? and when it is opened ... i would like to have a link or something that point to the php script that record the number of opened emails ... something like the below ...
<img src="http://www.something.com/openedmail.php?email=$email&open=yes">
on the openedmail.php ... i would like to have a mysql connection as i want to store that number inside a database ...
but first ... i need to know if i can know if the mails are opened by the recipient?
thanks for the help ... :)
etron
Sun 4th Jan '04, 10:03pm
and i would like to know the bounce emails as well ...
so, i have this ... aa@aa.com doesn't exist ...
$mailto = "aa@aa.com";
$mailsent = mail($mailto, "test", "testing message");
if (! $mailsent) {
$bounce_count += 1;
$bounce_email = $mailto;
}
will this work?
thanks ... :)
Noiz Pollution
Mon 5th Jan '04, 1:55pm
knowing whether an email has been opened or not is possible, in fact it's how a lot of spammers verify your email address
they put what's called a webbot in an html email which once the email is opened sends a variable to a script on their web server letting them know the mail has been opened and makes sure that email address stays on the list
i'd imagine it to be something like this<img src=http://someserver.com/bot.php?email=youremail@server.com border="" height="0" width="0" />
etron
Thu 8th Jan '04, 9:31pm
i have tested it out ... but it seem that i dont get any result ... i have check the database and there is no data inserted. here are the files:
test.php [ i use it to send the email out. ]
require('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "myserver.com";
$mail->SMTPAuth = true;
$mail->Username = "smtp_user";
$mail->Password = "smtp_pass";
$mail->From = "from_email@server.com";
$mail->FromName = "from_name";
$mail->AddReplyTo("from_email@server.com", "from_name");
$mail->Subject = "test mail open ...";
$mail->WordWrap = 50;
$mail->AddAddress("to_email@server.com", "to_name");
$mail->IsHTML(true);
$today = date("Ymd");
$body = "testing 123 ... <br><br>";
$body .= "<img src=\"http://myserver.com/email/mailopen.php?id=123&date=$today\ (http://myserver.com/email/mailopen.php?id=123&date=$today)" border=\"\" height=\"0\" width=\"0\">";
$mail->Body = $body;
$mail->Send();
$mail->ClearAddresses();
$mail->ClearAttachments();
print "Mail Sent ...";
and here is the mailopen.php file
$host = "localhost";
$user = "dbuser";
$pass = "dbpass";
$data = "dbname";
############ DATABASE CONNECTION ############
if ($link = mysql_connect($host, $user, $pass)) {
if (! mysql_select_db($data)) {
echo '<P>This script has connected to the MySQL but could not connect to the Database';
exit();
}
} else {
echo '<P>This script could not connect to the MySQL';
exit();
}
#############################################
$get_id = $_GET['id'];
$get_date = $_GET['date'];
$query = "select * from mailopen where id = $get_id and date = $get_date";
$result = mysql_query($query);
while ($getdata = mysql_fetch_array($result)) {
$open_count = $getdata["open_count"];
}
mysql_free_result($result);
if (! empty($open_count)) {
$query = "insert into mailopen(id, date, open_count) values($get_id, $get_date, 1)";
$result = mysql_query($query);
} else {
$open_count += 1;
$query = "update mailopen set open_count = $open_count where id = $get_id and date = $get_date";
$result = mysql_query($query);
}
$result = mysql_query("optimize table mailopen");
please help to pinpoint the problem i have with the script files. Thanks a million :)
vBulletin® v3.8.0 Beta 3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.