Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time stamp in mail

Status
Not open for further replies.

Manic

Programmer
Feb 28, 2001
343
GB
Hi,

I am sending a form using pearl and I was wondering how I could add a date/time stamp from the server and if possible from the users local machine.

The second isn't important, it is an I would like to have.

I am also trying to make the mail from section display their e-mail address but atm I am only getting from this is the code I have for the mail

------------------
open (MAIL, "|$mailprog $recipient") || die "Can't open $mailprog!\n";
print MAIL "Reply-to: $FORM{'Email'}\n";
print MAIL "Subject: Information Request \n\n";
------------------

The subject works and all of the data in the fome is fine.

I have looked all over for some reference material or a list of pearl commands but to no avail.

Any help would be greatly appriciated.

Thanks in advance


Manic
-----------------------------
I've broken it again !!
-----------------------------
lee.gale@virgin.net
 
If you add the Localtime module to your script (type use Time::Localtime; at the beginning of the script) and then add the following line:

$now = ctime();

When you send the data in the mail, just add the variable $now to it and when the mail sends, you'll have a line that says the current date in this format:

(abbreviated day of week) (abbreviated month) (day of month) (hour):(minute):(second) (year)

For an example, I just ran it and it returned:

Tue Feb 12 10:06:42 2002

Let me know if you need anything else!
 

Thanks for the help but I think I need more advice, all I seem to be getting now is an internal server error.

I have put the other bits in

# Time stamp
use Time::Localtime;
$now = ctime();

and

print MAIL "Time sent: $now";

Am I being realy dumb and missing something.

I am very new to this.

I realy paariciate the help.


Manic
-----------------------------
I've broken it again !!
-----------------------------
lee.gale@virgin.net
 
Do you have the Localtime module installed on the server? That could be the problem you're experiencing.
 
I will have to ask our provider.

Thanks for the help, it is appriciated.

Will take them out for the moment and hopefuly I will be able to get it up and running soon.
Manic
-----------------------------
I've broken it again !!
-----------------------------
lee.gale@virgin.net
 
If you don't have the Localtime module, there's a thread in the perl forum about formatting the time. Check that out. It doesn't require anything but native perl.

If you want the user's time as well, use a javascript function on the web page to get the time and put it in a hidden field passed to your program. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
thanks all got it working last night.


Manic
-----------------------------
I've broken it again !!
-----------------------------
lee.gale@virgin.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top