php imap_header,PHP: imap_headerinfo - Manual

Simple little code for checking gmail using headerinfo

Gmail mod for admin panels or you can edit it and convert html results to XML for personal RSS reader */

// enter gmail username below e.g.--> $m_username = "yourusername";$m_username="";// enter gmail password below e.g.--> $m_password = "yourpword";$m_password="";// enter the number of unread messages you want to display from mailbox or

//enter 0 to display all unread messages e.g.--> $m_acs = 0;$m_acs=15;// How far back in time do you want to search for unread messages - one month = 0 , two weeks = 1, one week = 2, three days = 3,

// one day = 4, six hours = 5 or one hour = 6 e.g.--> $m_t = 6;$m_t=2;//----------->Nothing More to edit below

//open mailbox..........please$m_mail=imap_open("{imap.gmail.com:993/imap/ssl}INBOX",$m_username."@gmail.com",$m_password)// or throw a freakin error............you pigor die("ERROR: ".imap_last_error());// unix time gone by or is it bye.....its certanly not bi.......or is it? ......I dunno fooker$m_gunixtp= array(2592000,1209600,604800,259200,86400,21600,3600);// Date to start search$m_gdmy=date('d-M-Y',time() -$m_gunixtp[$m_t]);//search mailbox for unread messages since $m_t date$m_search=imap_search($m_mail,'UNSEEN SINCE '.$m_gdmy.'');//If mailbox is empty......Display "No New Messages", else........ You got mail....oh joyif($m_search<1){$m_empty="No New Messages";}

else {// Order results starting from newest messagersort($m_search);//if m_acs > 0 then limit resultsif($m_acs>0){array_splice($m_search,$m_acs);

}//loop itforeach ($m_searchas$what_ever) {//get imap header info for obj thang$obj_thang=imap_headerinfo($m_mail,$what_ever);//Then spit it out below.........if you dont swallowecho"

Message ID# ".$what_ever."
Date: ".date("F j, Y, g:i a",$obj_thang->udate) ."From: ".$obj_thang->fromaddress."To: ".$obj_thang->toaddress."
Subject: ".$obj_thang->Subject."
Login to read message
";

}} echo"

".$m_empty."
";//close mailbox bi by byeimap_close($m_mail);?>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值