Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8336427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:59:18+00:00 2026-06-09T03:59:18+00:00

My PHP mail is sent with a wrong date & time. I’ve set my

  • 0

My PHP mail is sent with a wrong date & time.
I’ve set my PHP time:

date_default_timezone_set('Europe/Brussels');  

and when I

echo date('r'); //returns correctly: Thu, 02 Aug 2012 13:28:00 

I get the correct time. When I send a mail however, the date of the mail is the time now + 1 day + 1 hour.

I’ve searched around and found some old docs where it was a PHP bug or so, but those date from 2001 and 2005 so I presume I’m doing someting else wrong… I expect theres no error in the sending of the mail, since it does get sent, but I’ll post my code anyway:

<?php
    session_start();
    date_default_timezone_set('Europe/Brussels');
    $receiver = 'test@yourhost.com';
    $subject = 'Test';
    $message = 'This is a test';
    $receiver = $email;
    $headers = "From: me@myhost.com" . "\r\n" . "X-Mailer: PHP/" . phpversion();
    if(mail($receiver,$subject,$message,$headers)){
        //This is done
    }
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T03:59:20+00:00Added an answer on June 9, 2026 at 3:59 am

    Read this :-

    http://php.net/manual/en/function.date-default-timezone-set.php

    http://php.net/manual/en/function.date-default-timezone-get.php

    or

    try this

    date_default_timezone_set( 'America/New_York' );
    

    //or

    ini_set('date.timezone', 'America/Los_Angeles');  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

not sure what I am doing wrong. I set up a simple php mail
The following $header is being sent via PHP's mail($to,$subject,$content,$header) command. The mail arrives and
I have various emails being sent out via PHP mail. The problem is, for
For some reason, when php mail() is sent to a text number (via email)
I sent email confirmation massage using php mail() function but it's not processing html
I have a php mail script sitting on a LAMP vps server. The script
I am using PHP mail() to send daily notice emails. But I noticed that
We currently have a working php mail script, this works fine and as we
I'm trying to send mail via the PHP mail() function which as far as
I have a small script which im using to test PHP mail(), as below:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.