#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    3
    Rep Power
    0

    Angry All sent mail says "Wed, December 31, 1969 7:00 pm"


    On our LAMP server, whenever our php application sends emails out, the date on the emails is Wed, December 31, 1969 7:00 pm, which I figure to be UNIX time for ZERO, adjusted (?) for time zone? Maybe.

    For some recipients this is a major problem, because the mail automatically gets sorted to the very bottom of their inbox, never to see the light of day again.

    I doubt this has anything to do with the problem, but here's the code that sends the email out (simplified):

    <?php

    include_once("newsite.php");
    include_once("newdatabase.php");
    include_once("htmlMimeMail.php");

    function email($resp) {
    $subject = "Status Update";
    // create email object
    $mail = new htmlMimeMail();
    );

    // Add the text, html and embedded images.
    $html_data = fetch_page("email_contents", $assigns);
    $mail->setHtml($html_data);

    // Set some headers
    $mail->setFrom('"My Website" <me@mysite.com>');
    $mail->setSubject($subject);
    $mail->setHeader('X-Mailer', 'HTML Mime mail');

    // Send it using SMTP.
    $mail->setBcc("scott.williams@fidello.net");

    $result = $mail->send(array($resp->resp_email), "smtp");

    if (!$result) {
    echo "<li><font color=red>Error: $mail->errors</font></li>";
    }
    return $result;
    }

    if ($sendit) {
    error_reporting(E_ALL || ~E_NOTICE);
    $recs = $db->get_results("SELECT * FROM user WHERE email_sent IS NULL");
    foreach($recs as $rec) {
    echo "<li>email sent to $rec->user_name";
    if (email($rec)) {
    $db->query("UPDATE user SET email_sent=now() WHERE user_name=$rec->user_name");
    }
    $row++;
    }
    echo "<li>$row emails sent";

    }

    ?>

    Any ideas, pointers on where to look at the documentation, anything, I'd really appreciate it. I don't really administer this server, but I'm as likely a candidate as any to fix this particular problem. Thanks a lot.
    Regards,
    Scott Williams
    Penfield NY
  2. #2
  3. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    16
    If the application injecting the email doesn't include a date field, then the MTA (e.g. sendmail, qmail) will add one in.

    However, whether you use PHP to add a date field or leave this to your MTA, both these will produce an incorrect date field if your system clock is wrong.

    What does the output of the date command say?

    There is also the slim possibility that you have a broken MTA which doesn't add a date field when required. If you provide the source of one of the email messages, then we can verify this.

    See http://216.239.37.104/search?q=cache...hl=en&ie=UTF-8 for further discussion.
    Alex
    (http://www.alex-greg.com)
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    3
    Rep Power
    0
    Originally posted by alexgreg
    There is also the slim possibility that you have a broken MTA which doesn't add a date field when required. If you provide the source of one of the email messages, then we can verify this.
    Here's the "visible" information:
    Subject: Status Update
    From: "My Website" <me@mysite.com>
    Date: Wed, December 31, 1969 7:00 pm
    To: you@yoursite.net
    Priority: Normal

    "Full" header info:

    Return-Path: <me@mysite.com>
    Delivered-To: you@yoursite.net
    Received: (qmail 2720 invoked from network); 17 Oct 2003 17:17:35 -0000
    Received: from unknown (HELO www.mysite.com) (me@192.168.1.26)
    by 0 with SMTP; 17 Oct 2003 17:17:35 -0000
    MIME-Version: 1.0
    From: "My Website" <me@mysite.com>
    Subject: Status Update
    X-Mailer: HTML Mime mail
    Content-Type: text/html; charset="ISO-8859-1"
    Content-Transfer-Encoding: quoted-printable
    Message-ID: <hmwwir.b6t@www.mysite.com>
    To: you@yoursite.net



    So, where is that 1969 date coming from??
    Thanks.
  6. #4
  7. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    16
    Here's the "visible" information:
    "Visible" where? The incorrect date field (and the priority) is "visible" in whatever you're using to view the mail, but not in the "full" header information.

    You also didn't answer my previous question: What does the output of the date command (run on your server) say?
    Alex
    (http://www.alex-greg.com)

IMN logo majestic logo threadwatch logo seochat tools logo