如何读取传入电子邮件的IP地址

时间:2013-02-06 11:38:09

标签: php cakephp imap

我为我的课程设置了一个连续的项目,可以在线学习,家长也可以与之互动。所以我要求学生每天通过电子邮件发送项目进度。我使用imap获取信息并在线显示。

我理解电子邮件地址可能会被欺骗。如何确定邮件是否真的来自雅虎,gmail或hotmail。我可以使用哪种imap功能。我试过这个

  

imap_headerinfo($ inbox,$ email [$ x])

但它没有给我通过的服务器的IP地址。

我感谢任何帮助。

1 个答案:

答案 0 :(得分:4)

$mailinfo = imap_headerinfo($inbox, $emails[$x]);
print_r($mailinfo->from);

应该给你: personal, adl, mailbox, and host

以下任何一项都可以帮助您 $ mailinfo-> ...
(如需完整参考,请查看http://php.net/manual/en/function.imap-headerinfo.php

->to - an array of objects from the To: line, with the following properties: personal, adl, mailbox, and host

->from - an array of objects from the From: line, with the following properties: personal, adl, mailbox, and host

->ccaddress - full cc: line, up to 1024 characters

->cc - an array of objects from the Cc: line, with the following properties: personal, adl, mailbox, and host

->bccaddress - full bcc: line, up to 1024 characters

->bcc - an array of objects from the Bcc: line, with the following properties: personal, adl, mailbox, and host

->reply_toaddress - full Reply-To: line, up to 1024 characters

->reply_to - an array of objects from the Reply-To: line, with the following properties: personal, adl, mailbox, and host

->senderaddress - full sender: line, up to 1024 characters

->sender - an array of objects from the Sender: line, with the following properties: personal, adl, mailbox, and host

->return_pathaddress - full Return-Path: line, up to 1024 characters

->return_path - an array of objects from the Return-Path: line, with the following properties: personal, adl, mailbox, and host

为什么主机名很重要: enter image description here

(对不稳定的形象,坐在火车上)