Home > php教程 > php手册 > PHP查看邮件是否已被阅读

PHP查看邮件是否已被阅读

WBOY
Release: 2016-06-21 08:46:33
Original
950 people have browsed it

当你在发送邮件时,你或许很想知道该邮件是否被对方已阅读。这里有段非常有趣的代码片段能够显示对方IP地址记录阅读的实际日期和时间。 

  1. error_reporting(0); 
  2. Header("Content-Type: image/jpeg"); 
  3.     
  4. //Get IP 
  5. if (!emptyempty($_SERVER['HTTP_CLIENT_IP'])) 
  6.   $ip=$_SERVER['HTTP_CLIENT_IP']; 
  7. elseif (!emptyempty($_SERVER['HTTP_X_FORWARDED_FOR'])) 
  8.   $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; 
  9. else 
  10.   $ip=$_SERVER['REMOTE_ADDR']; 
  11.     
  12. //Time 
  13. $actual_time = time(); 
  14. $actual_day = date('Y.m.d'$actual_time); 
  15. $actual_day_chart = date('d/m/y'$actual_time); 
  16. $actual_hour = date('H:i:s'$actual_time); 
  17.     
  18. //GET Browser 
  19. $browser = $_SERVER['HTTP_USER_AGENT']; 
  20.         
  21. //LOG 
  22. $myFile = "log.txt"
  23. $fh = fopen($myFile'a+'); 
  24. $stringData = $actual_day . ' ' . $actual_hour . ' ' . $ip . ' ' . $browser . ' ' . "\r\n"
  25. fwrite($fh$stringData); 
  26. fclose($fh); 
  27.     
  28. //Generate Image (Es. dimesion is 1x1) 
  29. $newimage = ImageCreate(1,1); 
  30. $grigio = ImageColorAllocate($newimage,255,255,255); 
  31. ImageJPEG($newimage); 
  32. ImageDestroy($newimage); 
  33.         
  34. ?> 

PHP如何发送邮件



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template