Asked  2 Years ago    Answers:  5   Viewed   274 times

I have seen the service like placing a small image in the email and tracking when it is opened and from where. They track city, country, IP address etc. How is this done?

  1. How do we know when the mail is opened? And how is the image generated?
  2. How is the IP address detected and how is it possible to know location from it?



Basically, in the HTML body of your email, there will be an <img> tag that would look like this :

<img src="" alt="" />

When someone reads his mail, with images enabled, the email-client will send a request to tracker.php, to load the image, passing it id=123456 as a parameter.

This tracker.php script will be on your server, and, when called, it will :

  • Check the id parameter,
  • Use it to find to which email address it corresponds -- when generating the email for each one of your subscribers, you'll have generated an id different for each e-mail.
  • Do some stuff -- like log "email 123456 has been opened", and some additional informations
  • return the content of a small image ; like a 1x1 transparent gif.

The tracker.php script knows from which IP address it's been called -- like any other PHP script :

$ipAddress = $_SERVER['REMOTE_ADDR'];

And, starting from this IP address, you can use a geolocation service to find out from where in the world the email has been opened.
As a couple of examples, you could take a look at MaxMind, or IPInfoDB

As you know that id=123456 corresponds to one specific email address, this allows to find out where each one of your subscribers are.

Friday, December 2, 2022

After trying various ways, i found following code working with almost all email providers

$to['email'] = "recipients email address";      
$to['name'] = "name";   
$subject = "email subject";
$str = "<p>Hello, World</p>";
$mail = new PHPMailer;
$mail->SMTPAuth = true;
$mail->Host = 'Specify main and backup server here';
$mail->Port = 465;
$mail->Username = '[email protected]';
$mail->Password = 'email account password';
$mail->SMTPSecure = 'ssl';
$mail->From = 'From Email Address';
$mail->FromName = "Any Name";
$mail->AddReplyTo('[email protected]', 'any name'); 
$mail->Priority = 1;
$mail->AddCustomHeader("X-MSMail-Priority: High");
$mail->WordWrap = 50;    
$mail->Subject = $subject;
$mail->Body    = $str;
if(!$mail->Send()) {
$err = 'Message could not be sent.';
$err .= 'Mailer Error: ' . $mail->ErrorInfo;                        


variable values needs to be changed accordingly. Hope these helps people having issues with PHPmailer

Saturday, November 19, 2022

Try out this one. But for me it is only working on a real device.

    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emailaddress);
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);

    ArrayList<Uri> uris = new ArrayList<Uri>();

    uris.add(Uri.parse("android.resource://" + getPackageName() + "/" + R.drawable.file1));
    uris.add(Uri.parse("android.resource://" + getPackageName() + "/" + R.drawable.file2));

    emailIntent.putExtra(Intent.EXTRA_STREAM, uris));

Wednesday, December 14, 2022

I would do it something like this, using a MIFF to append individually labelled files to an output stream then read them all from stdin into the montage command:

for f in /tmp/*-thumb.jpg; do
  convert -label "$i Comment %f" "$f" miff:-
done | montage -       
   -frame 5            
   -tile 3x3           
   -geometry +10+10    
   -background black   

They come out looking like this:

Friday, September 30, 2022

PHP is probably not the actual sender of the eamil.

Check the email server (sendmail, exim, etc.) log files (on debian, logs are in /var).

Check the [email protected] or [email protected] email box for non-delivery notices.

Check if our ISP is publishing RDNS for your server IP with the wrong domain name.

Although less likely, check your domain's SPF at your registrar.

Wednesday, December 14, 2022
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :

Browse Other Code Languages