Jump to content

change the timestamp of mail sent by smtp


ramatya

Recommended Posts

I need to change the  timestamp of the mail sent through the smtp . right now the mail i receives is 7 hour ahead, when i run the script through browser the time displayed is ok, but when i run it by cron job its always 7 hour ahead.

 

my script is like this

 

$from = "From <[email protected]>";

$to = "Receiver <[email protected]>";

$subject = "Hi! Cron job timestamp test";

$body = "Hi,\n\n test msg and date is ?".date("Y-m-d H:i:s");

$host = 'host';

$username = 'username';

$password = 'password';

$port = "25";

 

 

$headers = array ('From' => $from,

  'To' => $to,

  'Subject' => $subject);

$smtp = Mail::factory('smtp',

  array ('host' => $host,

    'port' => $port,

    'auth' => true,

    'username' => $username,

    'password' => $password));

 

$mail = $smtp->send($to, $headers, $body);

 

if (PEAR::isError($mail)) {

  echo("<p>" . $mail->getMessage() . "</p>");

  } else {

  echo("<p>Message successfully sent!</p>");

  }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.