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 <from@domain.com>";

$to = "Receiver <to@domain.com>";

$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>");

  }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.