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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another CFMAIL question 2

Status
Not open for further replies.

calista

Programmer
Jan 24, 2001
545
US
I just noticed that the timestamp is wrong on my messages. In my Inbox, the time received is correct, but when you open the message, the time sent is wrong by several hours. Where do I change this?

To clarify, I am currently testing my first email application on my workstation. My workstation clock is set to the correct time. I am running NT 4.0 and Microsoft PWS on my workstation. I cannot find anywhere in PWS or Cold Fusion Administrator how you set the time. I'm not even sure if it is set in Cold Fusion or PWS.

Thanks, again, everyone, for your help! Calista :-X
Jedi Knight,
Champion of the Force
 
Hey Calista,

I believe the message time stamp will be set by the mail server and not the mailer (CF). I would check to see which mail server CF is configured to use and then check the time on that server. Let me know if this isn't the case as I've never watched to see whether mailer or server sets the initial time but I'm fairly sure it's the mail server.

Take care,
GJ
 
I am using the company mail server. All the other messages come through with the correct time sent. The only ones that show a bad timestamp are the ones I sent through CF. Calista :-X
Jedi Knight,
Champion of the Force
 
Hi Calista,

You can use this code to set the Date on an Email but it doesn't necesarily make that be the date that shows as recieved. Maybe it will work for you.

<CFMAIL From=&quot;me@mine.com&quot;
To = &quot;you@yours.com&quot;
Subject = &quot;Check Date&quot;>
<CFMAILPARAM name=&quot;Date&quot; value=&quot;Wed, 6/6/01 10:39:44 -0500&quot;>
Check Date
</CFMAIL>

You could create that date string like this:
#Dateformat(NOW(),&quot;ddd, m/d/yy&quot;)#&#Timeformat(now(),&quot; hh:mm:ss&quot;)#

I don't know what the 0500 is on there.

This works in that it sets the Date field in the header to the given date and time but when I recieve a mail in Outlook it doesn't show as the recieved date. Try it and see what it does for you.
 
Thanks, tlhawkins! OK, here's what I did and here's what happened.
First, I created a variable to hold the current date and time:
Code:
<CFSET CURRENTDATETIME = &quot;#DateFormat(Now() , &quot;DDD M/D/YY&quot; )# #TimeFormat(Now() , &quot;HH:MM:SS TT&quot;)#&quot;>
Here's my CFMAIL:
Code:
<CFMAIL TO=&quot;Jane Doe <JaneDoe@company.com>&quot;
        FROM=&quot;John Smith <JohnSmith@company.com>&quot;
        SUBJECT=&quot;#GetForumProduct.ForumName#&quot;
		TYPE=&quot;HTML&quot;>
		#Sender# has posted a new message in the #GetForumProduct.ForumName# forum.<BR>
		Click on this link to view:<BR>
		<A HREF=&quot;#Application.RootPath#Discussion/ViewThread.cfm?ThreadID=#ThisThread#&quot;>#Application.RootPath#Discussion/ViewThread.cfm?ThreadID=#ThisThread#</A>
		<CFMAILPARAM NAME=&quot;Date&quot; VALUE=&quot;#CurrentDateTime#&quot;>
</CFMAIL>
When the message arrives, and you open it, in the header it shows &quot;Sent: None&quot;. Did I do something wrong with your code? BTW, we're using Outlook, too. Calista :-X
Jedi Knight,
Champion of the Force
 
Hey Calista,

I got this information and the date string from looking at the actual mail header from Outlook. if you open an Email and goto View/Options it shows (In a little scroll box) all of the header parameters. The Date string had the format I showed you and then it had &quot; -0500&quot; I see you added the TT in your time format string. That very well might be what it is but when I just added -0500 at the end my emails went through and the SENT date when you open the mail was correct, although the recieved date I think is actually when it showed up on your computer and I can't change that. So I would look through some of your Email and see if you can figure out what that -0500 is . IF you can't figure it out just put the -0500. I looked through a bunch of mine and found all of them were either -0400 or -0500 at the end. I'm sure somebody out there knows why and isn't telling :). Where's GunJack when you need him.

The only other thing I can suggest is that I always put my
<cfmailparam.. tag directly after the orginal <cfmail... tag, not sure if it matters.

Hope you get it working. I was having Email issues yesterday when I tested this so I didn't realize how well itwas working but it really did work.
 
Hey Calista,

I was wrong, I just ran a check and my mail client (Eudora) shows the time stamp from the CF server. My PC, CF server, and mail server are all a few minutes apart so it's definitely getting the timestamp from the CF server.

If the time is off by exactly a set number of hours, I would suspect that somehow there is a timezone problem. In IIS, when you specify the extended log format, it automatically logs everything in GMT. I'm wondering if somehow PWS or even CF has something set that's making it think it should use a different time zone. I would check your PWS log files and see if the entries correspond to your current timezone or not.

Just for kicks, I would output #now()# in your mail message just to verify what date and time CF sees from the OS.

Btw, is this part of a larger application or is it just a standalone piece? If part of another application, I would check for any instances of getLocale() or setLocale(). I've never used these but I suspect they could interfere with date/times.

Good luck,
GJ
 
If I do not include the CFMAILPARAM, it is off by 8 hours (time sent shows 8 hours earlier than it really is). If I use a timestamp such as {ts '2001-06-07 09:58:17'} in CFMAILPARAM, the time sent shows &quot;Fri 1/05/07 7:00PM&quot; no matter what time I sent the message. I have tried leaving out the &quot;tt&quot; from the time format, I have formatted it every way I can think of. If I use a variable, I get &quot;Sent: None&quot;. If I hard code the date and time, I get &quot;None&quot; If I have #Now()# in the body of the message, it shows the correct time. Here's what I have now:
Code:
<CFMAIL TO=&quot;John Doe <johndoe@company.com>&quot;
        FROM=&quot;Jane Doe <janedoe@company.com>&quot;
        SUBJECT=&quot;TestMessage&quot;
		TYPE=&quot;HTML&quot;>
		<CFMAILPARAM NAME=&quot;Date&quot; VALUE=&quot;#Now()# -0400&quot;>
		This is the body of the test message.<BR>
		The current date and time is #Now()#	
</CFMAIL>
I agree there must be a setting somewhere, but I haven't been able to find it. What I am trying to implement is an email notification system on my intranet discussion board so that a list of users is notified when a post is made to forums they have subscribed to (Sound familiar?)

In the meantime, I will check my PWS log files as you suggested. Thanks for all your help! Calista :-X
Jedi Knight,
Champion of the Force
 
OK, guys, here's an update. I check the CF Administrator log files, specifically the mail log file, and both it and the other log files show the correct time. I couldn't find any log file under PWS. Maybe I didn't enable them? I am open to any suggestions about this. Thanks, GunJack! You're the best! You, too, tlhawkins! Thanks for sticking with me on this. This is one of those pesky little problems that is going to drive me crazy X-) until we get it fixed. Catch ya later! Calista :-X
Jedi Knight,
Champion of the Force
 
Hey Calista,

Did you output #now()# inside a mail message? I'm curious to see what system time CF sees. Also, can you send me a message through this app so I can see the header info? If so, send it to gunjack@atlbiz.com.

Good luck,
GJ
 
Yes, I put #Now()# in the body of a message, (see my earlier post for the code) and it showed the correct time. I will try to send you a message through this application. Here goes nuthin'! Calista :-X
Jedi Knight,
Champion of the Force
 
Well, I couldn't get a message out to you through this application. I even copied it over to my &quot;real&quot; server and tried it there. I suspect our firewall won't allow me to send email externally except through Outlook. Calista :-X
Jedi Knight,
Champion of the Force
 
Oh well...

Is there any chance of the get/set locale functions interferring? Also, is the timestamp ok when you run it from your real server?

GJ
 
Sorry, I forgot to mention that I'm not using either of those functions. Yes, the timestamp is OK on my real server. I viewed the Undlvr in Notepad. Calista :-X
Jedi Knight,
Champion of the Force
 
I just sent a message to myself through my real server WITHOUT a CFMAILPARAM tag, and the time sent is correct! So, it's just on my machine. There must be a setting somewhere that needs to be changed. I'd still like to know what's wrong, but as long as it works on the real server, that's the important part. However, someone else is having the same problem (I'd have to scroll back through the forum to see who) I am. I don't know if he's been following this thread, or not, but he seems to be having a problem on his &quot;real&quot; server. I think I'll check that thread and see what responses he has. Thanks a million, guys! Calista :-X
Jedi Knight,
Champion of the Force
 
Hey Calista,

I found some info on the allaire forums. It appears this is a bug in CF 4.5 that doesn't appear in 4.0 versions. If your real server is running 4.0, I think that explains the difference. The posts weren't that specific but it sounds like un-checking daylight savings time may help in some scenarios while CF service pack2 may resolve it in others. Someone posted this code as something that helped so you might try this.

<CFSET tzStruct = GetTimeZoneInfo()>
<CFSET dateString =
&quot;#DateFormat(Now(),'DDD, DD MMM YYYY')#&quot;
& &quot; #TimeFormat(Now(),'HH:mm:ss')#&quot;
& &quot; -&quot;
& &quot;#NumberFormat(tzStruct.utcHourOffset,'00')#&quot;
& &quot;00&quot;>

Then in all of your CFMAIL tags on the same page put the following:

<CFMAILPARAM NAME=&quot;Date&quot; VALUE=&quot;#dateString#&quot;>

Hope this helps,
GJ
 
Hey! That worked! Thanks, pal! Calista :-X
Jedi Knight,
Champion of the Force
 
P.S. Just FYI, I am running the Enterprise Single User 4.5.0 that came with Studio, and my real server is running Professional 4.5.2 with SP2. I'll have to see if I installed SP2 on my machine, or if I can. I guess 5.0 is due out shortly, so I will be receiving an update at that time. Thanks for everything! Calista :-X
Jedi Knight,
Champion of the Force
 
Hey guys,

I just got in and caught up on what was going on. Great solution. I just knew it was going to have to do with that -0500 thing. So I guess that is the timezone offset. Good thing to know.

Thanks GunJack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top