Yahoo Clever wird am 4. Mai 2021 (Eastern Time, Zeitzone US-Ostküste) eingestellt. Ab dem 20. April 2021 (Eastern Time) ist die Website von Yahoo Clever nur noch im reinen Lesemodus verfügbar. Andere Yahoo Produkte oder Dienste oder Ihr Yahoo Account sind von diesen Änderungen nicht betroffen. Auf dieser Hilfeseite finden Sie weitere Informationen zur Einstellung von Yahoo Clever und dazu, wie Sie Ihre Daten herunterladen.

The time is wrong on my emails sent by php sendmail script?

I am sending emails using the php sendmail script. The problem is, the server is on a different timezone than I am and the emails appear to have been send 5 hours before. Is there a way to change the time sent on email in php? I am using php on a Windows platform - v5.0

Update:

Just a reminder, I am using an older version of PHP that apparently does NOT allow you to set the timezone.

5 Antworten

Relevanz
  • Anonym
    vor 1 Jahrzehnt
    Beste Antwort

    Add the datetime you want to use as an additional header.

    <?php

    date_default_timezone_set( "America/New_York" );

    $now = new DateTime();

    $to = "you@you.com";

    $header = "From: me@me.com\r\nDate: " . date_format($now, 'r');

    $subject = "foobar";

    $body = "hello world";

    mail( $to, $subject, $body, $header );

    ?>

  • vor 1 Jahrzehnt

    Version 5 of PHP is not an "older" version, it's still actually pretty new, as v6 is not in widespread use yet.

    Other than that, I can only suggest that you look into mail headers. There are options for time/date there.

  • Anonym
    vor 1 Jahrzehnt

    I found a site good for programmers to ask questions. There are some experienced programmers there, so you can get help there. It's free by the way.

    http://www.geekpolice.net/

  • vor 1 Jahrzehnt

    if you look at source #1, it will have the syntax for the mail(); function. Date looks like it should be in the additional headers section. Try looking into that.

  • Wie finden Sie die Antworten? Melden Sie sich an, um über die Antwort abzustimmen.
  • vor 1 Jahrzehnt

    I think its belong to the time of your server

Haben Sie noch Fragen? Jetzt beantworten lassen.