Author Topic: Time adjustment  (Read 2101 times)

richardwing

  • Posts: 39
    • View Profile
Time adjustment
« on: October 18, 2006, 12:01:00 pm »
Is there a way to adjust the timestamp placed onto the emails that I send out from the script?

I would like to set the time to a few hours ahead of the actual time I am sending so that they apear at the top of the recipients incoming mail.

By the time my email gets sent from the server its a good 2 hours and since I am on my own list when it comes in it gets placed with the emails of the time that it was sent not when it actually came in so its lost way down in my emails. I get alot.

I know that if others get as much as I do when the mail comes in they might miss it if they have already looked at mail from that time frame when mine eventually comes in they would have missed it.

Dean, can you tell me where this setting would be in the script to adjust the date and or time that apears on the email timestamp prior to getting queued?

Thanks,
Richard Wing
Richard Wing

"Give a man a fish, feed him for a day. Teach a man to fish and you can sell him all kinds of fishing equiptment!" ;)

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Time adjustment
« Reply #1 on: October 19, 2006, 11:31:48 pm »
Hi Richard,

The code is in admin.php
Code: [Select]
    $date = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);

Now, do you want the -same- time on all messages?  We could do this as follows:

To increase the time by 1 hour...

First add this:
Code: [Select]
$mytime = mktime(date("Y"),date("m"),date("d"),date("H"),date("i"),date("s"));
just after...
Code: [Select]
// queue loop !!!

Then change this:
Code: [Select]
    $date = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
to this:
Code: [Select]
    $date = sprintf("%s %s%04d", date("D, j M Y H:i:s",$mytime), $tzs, $tz);

If you don't want the same time on all messages and want to increase it on-the-fly, then ignore step 1 and just change this:
Code: [Select]
    $date = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
to this (+1hr):
Code: [Select]
    $date = sprintf("%s %s%04d", date("D, j M Y H:i:s",mktime(date("Y"),date("m"),date("d"),date("H")+1,date("i"),date("s"))), $tzs, $tz);
Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

richardwing

  • Posts: 39
    • View Profile
Time adjustment
« Reply #2 on: October 26, 2006, 12:24:46 am »
I guess I want the second set of instructions...

I just want to have the emails appear to the recipient at a time that is about 2 to 3 hours prior to the time I actually sent them out from LMP.

So if I send them at 2pm my servers time. They would as they got delivered say that the time is 5pm. which in turn places them in their list at the top if they sort by incoming time.

as new emails come in my email stays at the top until the actual time passes and then after 5pm it falls in line with other emails that come in after that time.

I have a few emails from someone who timestampped their emails for a future date and time and they stay at the top of my list because that date has not come yet.

This is what gave me the idea for what I am asking.

So is number two example what I want?

Thanks again for your time.

Richard
Richard Wing

"Give a man a fish, feed him for a day. Teach a man to fish and you can sell him all kinds of fishing equiptment!" ;)

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Time adjustment
« Reply #3 on: October 26, 2006, 12:33:21 am »
Hi Richard,

Either one can work - do you understand the difference? In the first one the time is set -before- the mailing starts and in the second one the time is calculated from the time the message is actually sent to the SMTP server.  Therefore if your mailing takes say 2 hours starting from midnight with the second example and an increase of 2 hours the messages will appear to be from anywhere between 2am and 4am.  With the first example and an addition of +2 hours messages sent at anytime during the mailing would appear to come at 4am. :roll:

For the second one, which is probably best, just change the +1 in the example to +2 or +3, for the number of hours you would like to increase it.

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

richardwing

  • Posts: 39
    • View Profile
Time adjustment
« Reply #4 on: November 04, 2006, 10:19:01 am »
Dean,

thanks for your help. I figured out that I needed to have the last line of code you recommended to this code I am showing here in case others look for this solution in the future.

Code: [Select]
$date = sprintf("%s %s%04d", date("D, j M Y H:i:s",mktime(date("H")+3,date("i"),date("s"),date("m"),date("d"),date("Y"))), $tzs, $tz);

Thanks again!
Richard Wing

"Give a man a fish, feed him for a day. Teach a man to fish and you can sell him all kinds of fishing equiptment!" ;)

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Time adjustment
« Reply #5 on: November 05, 2006, 05:50:03 pm »
That looks right - not sure why I did year,month,day,hour,min,sec instead of hour,min,sec,year,month,day with mktime().  It's clearly noted here:

http://php.net/manual/en/function.mktime.php

Ah well - glad you were able to figure it out!
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting