PHP Classes

specific header

Recommend this page to a friend!

      POP3 e-mail client  >  All threads  >  specific header  >  (Un) Subscribe thread alerts  
Subject:specific header
Summary:how to get the subject header
Messages:9
Author:Pablo Fuentes
Date:2007-06-06 20:07:42
Update:2007-08-02 18:13:32
 

  1. specific header   Reply   Report abuse  
Picture of Pablo Fuentes Pablo Fuentes - 2007-06-06 20:07:42
Hi, I try the pop3 class but I want to get the subjetc header, I can't not get this by the $line header because depending on the cliente used to send the email the class show diferente header on diferent lines, like this:
(for security reasons and to show my point I clean the headers response)

the number show the header line returned

///////////////////// FROM GMAIL AND HOTMAIL /////////////////////
0 : Return-path:
1 : Envelope-to:
2 : Delivery-date:
3 : Received:
4 : Received:
5 : Received:
6 : Message-ID:
7 : Received:
8 : X-Originating-IP:
9 : X-Originating-Email:
10 : X-Sender:
11 : From:
12 : To:
13 : Subject:
14 : Date:
15 : Message-ID:
16 : MIME-Version: 1.0
17 : Content-Type:
18 : X-Mailer:
19 : Thread-Index:
20 : Content-Language:
21 : X-OriginalArrivalTime:

/////////////////// FROM MY EMAIL SERVER ////////////////////////

0 : Return-path:
1 : Envelope-to:
2 : Delivery-date:
3 : Received:
4 : From:
5 : To:
6 : Subject:
7 : Date:
8 : Message-ID:
9 : MIME-Version: 1.0
10 : Content-Type:
11 : X-Mailer:
12 : Thread-Index:
13 : Content-Language:

//////////////////// FROM YAHOO ///////////////////////////

0 : Return-path:
1 : Envelope-to:
2 : Delivery-date:
4 : Received: (
5 : DomainKey-Signature:
6 : X-YMail-OSG:
7 : Received:
8 : Date:
9 : From:
10 : Subject:
11 : To:
12 : MIME-Version: 1.0
13 : Content-Type:
14 : Content-Transfer-Encoding:
15 : Message-ID:


Thanks






  2. Re: specific header   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-06-06 22:57:00 - In reply to message 1 from Pablo Fuentes
You need to search the headers array and check which line has the subject header.

  3. Re: specific header   Reply   Report abuse  
Picture of Pablo Fuentes Pablo Fuentes - 2007-06-07 03:22:06 - In reply to message 2 from Manuel Lemos
Ok, I search on the headers array but I try to show on my post the array doesn't have the same estructure, it dependes on the client used to send the mail.

If you see the headers I get from diferent mail accounts it show the subject on diferent header line..

How can access to especific header like $subject=mysql_fecth_array[subject]?


Thanks

  4. Re: specific header   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-06-07 03:59:07 - In reply to message 3 from Pablo Fuentes
What I am trying to tell you is that you need to check the array with all headers returned by the class, one by one until you find the headers you want.

  5. Re: specific header   Reply   Report abuse  
Picture of Pablo Fuentes Pablo Fuentes - 2007-06-07 16:18:28 - In reply to message 4 from Manuel Lemos
I get your point,

thanks.

  6. Re: specific header   Reply   Report abuse  
Picture of Pablo Fuentes Pablo Fuentes - 2007-06-08 17:09:31 - In reply to message 4 from Manuel Lemos
Continue with the Subject header, now I found a problem to try to read the From header, if some one send an email and use the character "ņ" wich is very usefull in spanish words, the Subject header lost all info or the sense

example:

Subject: Maņana nos reunimos.

Subject returned by the class:

Subject: =?iso-8859-1?Q?Ma=F1ana_nos_reunimos.?=


How can I prevent to chance or retur the real message on the Subject header?

Thanks

  7. Re: specific header   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-06-08 19:45:48 - In reply to message 6 from Pablo Fuentes
You need to parse the message headers. The POP3 class does not parse the message. Use the MIME parser class to parse the message, as it can decode those headers with 8 bit characters.

phpclasses.org/mimeparser

  8. Re: specific header   Reply   Report abuse  
Picture of Saulo Benigno Saulo Benigno - 2007-07-27 01:21:05 - In reply to message 6 from Pablo Fuentes
Hey Pablo Fuentes,
can you helpme with the function to search the header array ?

How can I do it ?

Thanks.

  9. Re: specific header   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2007-08-02 18:13:32 - In reply to message 8 from Saulo Benigno
Please use the MIME parser class as I mentioned above. The Decode function of that class returns an array with all message headers. Then use the PHP array traversing functions to find the headers you are looking for.