Solved

Date problems in email

Posted on 2002-05-17
2
270 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

751 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