Solved

Date problems in email

Posted on 2002-05-17
2
259 Views
Last Modified: 2008-03-06
I have a client with a PHP form that uses the sendmail function.  The date reported on the sent email is 13 hours prior to the actual date, which can be seen since the text of the email contains the date and time.
  They are using their internal Exchange Server.
  The date / time and locale is correct on the web server and Exchange Server.
  Email sent via Outlook from the web server is dated correctly, which is why I am posting this in the PHP directory.
0
Comment
Question by:rscaiefe
2 Comments
 
LVL 2

Accepted Solution

by:
vmv earned 100 total points
ID: 7017955
Try creating the date header yourself:

mail($to,$subj,$text,'Date: '.date('r').'\r\n')

Warning: this won't work in PHP earlier than 4.0.4.
0
 
LVL 1

Author Comment

by:rscaiefe
ID: 7029567
I am awarding 50 points since the solution did not exactly fit.  However, vmv was definitely on the right track.  The final solution was:
  mail($to,$subj,%text,'Date: '.gmdate('r').\r\n
The date function in vmv's suggestion brought the time to within 5 hours (CST time offset).  Seems that storing the GMT date is what NT needs as its UCT date.
Thanks for the help.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question