Solved

Date problems in email

Posted on 2002-05-17
2
230 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now