Login   Register  
PHP Classes
elePHPant
Icontem

Code Fix

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      MIME E-mail message sending  >  All threads  >  Code Fix  >  (Un) Subscribe thread alerts  
Subject:Code Fix
Summary:There is a problem when sending mails on localized php
Messages:5
Author:Pablo
Date:2006-04-29 14:06:19
Update:2006-05-05 03:34:00
 

  1. Code Fix   Reply   Report abuse  
Picture of Pablo
Pablo
2006-04-29 14:06:19
When PHP has been localized for non-english date/time, emails sent with 'smtp_message' will have a malformed date.

To fix this, modify line (circa) 503 / 509 (depends on version)
Where it says:
$header_data.="Date: ".strftime("%a, %d %b %Y %H:%M:%S %Z")."\r\n";

To:
$header_data.="Date: ".date("D, j M Y H:i:s O")."\r\n";

That's all.
Thanks for this wonderfull class!

  2. Re: Code Fix   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2006-04-29 18:22:07 - In reply to message 1 from Pablo
The RFC 2822 does not say that the date and time must necessarily be in the local time zone offset. As long as the time in the specified time zone is correct, it should not matter.

As a matter of fact, qmail always use UTC regardless what is the local time zone.

Anyway, the class only sets the Date: header if you have not specified it when the message is composed. If you want to set the message Date: header to use a specific time zone, just use:

$email_message->SetHeader("Date", date("D, j M Y H:i:s O"));

  3. Re: Code Fix   Reply   Report abuse  
Picture of Pablo
Pablo
2006-05-02 17:24:03 - In reply to message 2 from Manuel Lemos
The problem is not with time/zone data, but with the date as appears using the strftime function.

When the time is in spanish (per example) as with the original code (strftime) and php localized (set_locale (ALL, 'espanol')), the date will be sent localized:
Per Example: Vie, 05 Abr 2004 12:48:24 -0300

As stated on the RFC 2822, point 3.3.
Valid dates are only those on the english language.
And that makes the class be out of RFC, needing to be fixed on that matter.

Best Regards,
Pablo.

  4. Re: Code Fix   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2006-05-04 01:35:42 - In reply to message 3 from Pablo
Humm... you are right, I misunderstood your report.

I have just uploaded fixed versions of all the affected sub-classes.

Thank you for reporting.

  5. Re: Code Fix   Reply   Report abuse  
Picture of Pablo
Pablo
2006-05-05 03:34:00 - In reply to message 4 from Manuel Lemos
Thanks