Php implementation to check whether the email has been read

Source: Internet
Author: User
Tags get ip
When you send an email, you may want to know whether the email has been read by the recipient. The following code can meet this requirement. For more information, see

When you send an email, you may want to know whether the email has been read by the recipient. The following code can meet this requirement. For more information, see

When you send an email, you may want to know whether the email has been read by the recipient. Here is a very interesting code snippet that shows the actual date and time when the recipient's IP address records are read.

The Code is as follows:


Error_reporting (0 );
Header ("Content-Type: image/jpeg ");

// Get IP
If (! Empty ($ _ SERVER ['HTTP _ CLIENT_IP '])
{
$ Ip = $ _ SERVER ['HTTP _ CLIENT_IP '];
}
Elseif (! Empty ($ _ SERVER ['HTTP _ X_FORWARDED_FOR '])
{
$ Ip = $ _ SERVER ['HTTP _ X_FORWARDED_FOR '];
}
Else
{
$ Ip = $ _ SERVER ['remote _ ADDR '];
}

// Time
$ Actual_time = time ();
$ Actual_day = date ('Y. m. D', $ actual_time );
$ Actual_day_chart = date ('d/m/Y', $ actual_time );
$ Actual_hour = date ('H: I: s', $ actual_time );

// GET Browser
$ Browser = $ _ SERVER ['HTTP _ USER_AGENT '];

// LOG
$ MyFile = "log.txt ";
$ Fh = fopen ($ myFile, 'a + ');
$ StringData = $ actual_day. ''. $ actual_hour.''. $ ip. ''. $ browser.''. "\ r \ n ";
Fwrite ($ fh, $ stringData );
Fclose ($ fh );

// Generate Image (Es. dimesion is 1x1)
$ Newimage = ImageCreate (1, 1 );
$ Grigio = ImageColorAllocate ($ newimage, 255,255,255 );
ImageJPEG ($ newimage );
ImageDestroy ($ newimage );

?>

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.