|
AllRound - 2006-01-11 15:37:44
Great class, very useful to me! I only can't seem to figure out how to retreive the "from" email address from the email message. Could you tell me how this is done?
Harish Chauhan - 2006-01-12 04:07:10 - In reply to message 1 from AllRound
You cam retrive headers information from object returned by function get_parsed_message();
$res = $mimedecode->get_parsed_message();
to retrive header information you can use
$res->headers //Array
//To $res->headers['to']
//From $res->headers['from']
// print_r($res->headers)
AllRound - 2006-01-12 16:01:53 - In reply to message 2 from Harish Chauhan
Ah, I missed that part. Thanks!
James Bond - 2006-02-08 18:38:15 - In reply to message 2 from Harish Chauhan
Hello,
how can I get the sender's email address, using your class?
Harish Chauhan - 2006-02-09 03:57:40 - In reply to message 4 from James Bond
You cam retrive headers information from object returned by function get_parsed_message();
$res = $mimedecode->get_parsed_message();
to retrive header information you can use
$res->headers //Array
//To $res->headers['to']
//From $res->headers['from'] //Sender's Email
// print_r($res->headers)
James Bond - 2006-02-09 19:21:59 - In reply to message 5 from Harish Chauhan
Thanks for reply but I still have a problem. Could you help me and show me where exactly should I put this code:
"$res = $mimedecode->get_parsed_message();
to retrive header information you can use
$res->headers //Array
//To $res->headers['to']
//From $res->headers['from'] //Sender's Email
// print_r($res->headers)"
in impclasstest.php to get sender's email address into "$sender" so I can use sender's email address for replay in my php script?
Attachment: code of impclasstest.php:
<?php
include_once("imap.inc.php");
include_once("mimedecode.inc.php");
$imap=new IMAPMAIL;
if(!$imap->open("192.168.0.26","143"))
{
echo $imap->get_error();
exit;
}
$imap->login("harishc","hchauhan");
echo $imap->error;
$response=$imap->open_mailbox("INBOX");
echo $imap->error;
//echo $response=$imap->get_msglist();
//echo $response=$imap->delete_message(9);
//echo $response=$imap->rollback_delete(9);
$response=$imap->get_message(1);
///Decoding the mail
$mimedecoder=new MIMEDECODE($response,"\r\n");
$msg=$mimedecoder->get_parsed_message();
print_r($msg);
//echo nl2br($response);
echo $imap->get_error();
$imap->close();
//$response=$imap->fetch_mail("3","BODYSTRUCTURE");
//print_r($response);
//echo nl2br($response);
//echo $imap->error;
echo "<br>";
?>
Alfredo Herrejon - 2009-03-24 16:22:40 - In reply to message 5 from Harish Chauhan
Hello Harish, i am trying to read all the MAILER-DAEMON email so i used the $imap->search_mailbox("FROM \"MAILER-DAEMON\"") and all is working fine, but when i tried to make a get $msg=$mimedecoder->get_parsed_message()
and i want to get the headers the $msg->headers is empty also the $msg->headers['to'] and $msg->headers['from'], can you help me please, what i am missing? Thanks in advance.
My code:
$mailer = $imap->search_mailbox("FROM \"MAILER-DAEMON\"");
foreach($mailer as $k=>$v)
{
$response=$imap->get_message($v);
$mimedecoder=new MIMEDECODE($response,"\r\n");
$msg=$mimedecoder->get_parsed_message();
print_r($msg->headers);
echo $msg->headers['from'];
echo $msg->headers['to'];
}
if i print $msg all works, but the output of headers is empty.
Have a nice day!!!
erastus - 2009-04-02 20:19:20 - In reply to message 7 from Alfredo Herrejon
echo htmlspecialchars($msg->headers['from']);
//<test@test.com> is html
//browser wont show <test@test.com> since it resembles normal html <>
or
$replace = array('<','>');
echo str_replace($replace,'',$msg->headers['from'])
ravindra reddy - 2009-10-10 08:41:36 - In reply to message 2 from Harish Chauhan
hi sir,
how to get attach files download options using imap and also read attach files please tell me sir
Anders Jenbo - 2012-03-30 08:06:06 - In reply to message 9 from ravindra reddy
You need to fetch the decired part of the message.
|