u wrote u r doing the follwing:
headerlines.insert(0, 'date: ' + rfc822datetime(now));

u mean u added that to the ecoding process or u just not using the encode 
process?
after all, encoding process takes the msg.header.date and put it in the headers.





amos

you have to do the conversion yourself - in my case i do this

headerlines.insert(0, 'date: ' + rfc822datetime(now));

on sending (rfc822datetime is part of lukas's code)

and

mnd.emails_sent.asdatetime := converttogmt(getheaderline('date', hdrs, 1024));

on receiving


roy lambert


function converttogmt(datestr: string): tdatetime;
var
acton: string;
currentbit: string;
chopper: integer;
month: integer;
day: integer;
year: integer;
offset: integer;
hour: word;
minute: word;
sec: word;
datecreated: boolean;
function grabnum: integer;
begin
chopper := 1;
while acton[chopper] in ['0'..'9'] do inc(chopper);
if chopper > 1 then result := strtoint(copy(acton, 1, chopper - 1)) else result 
:= 0;
acton := copy(acton, chopper + 1, maxint);
end;
procedure grabmonth;
const
shortmonths: array[1..12] of string = ('jan', 'feb', 'mar', 'apr', 'may', 
'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec');
longmonths: array[1..12] of string = ('january', 'february', 'march', 'april', 
'may', 'june', 'july', 'august', 'september', 'october', 'november', 
'december');
begin
chopper := 1;
while acton[chopper] in ['a'..'z', 'a'..'z'] do inc(chopper);
currentbit := copy(acton, 1, chopper - 1);
month := 1;
while (month < 13) and (not (currentbit = shortmonths[month])) and (not 
(currentbit = longmonths[month])) do inc(month);
acton := copy(acton, chopper + 1, maxint);
end;
function gettimezone: integer;
const
timezones: array[1..28] of string = ('gmt', 'bst', 'ist', 'west', 'cet', 
'cest', 'eet', 'eest', 'msk', 'msd', 'ast', 'adt', 'est', 'edt', 'cst', 'cdt', 
'mst', 'mdt', 'pst', 'pdt', 'hst', 'akst', 'akdt', 'aest', 'aedt', 'acst', 
'acdt', 'awst');
fromgmt: array[1..28] of real = (0, 1, 1, 1, 1, 2, 2, 3, 3, 4, -4, -3, -5, -4, 
-6, -5, -7, -6, -8, -7, -10, -9, -8, 10, 11, 9.3, 10.3, 8);
var
zonecntr: integer;
begin
result := 0;
zonecntr := 1;
while (zonecntr < high(fromgmt)) and (not (acton = timezones[zonecntr])) do 
inc(zonecntr);
if acton = timezones[zonecntr] then result := trunc(100 * fromgmt[zonecntr]);
end;
begin
acton := trim(datestr);
if acton <> '' then begin
try
if not (acton[1] in ['0'..'9']) then acton := copy(acton, pos(' ', acton) + 1, 
maxint);
while acton[1] = ' ' do delete(acton, 1, 1);
if (acton[1] in ['0'..'9']) then begin
day := grabnum;
grabmonth;
year := grabnum;
if year < 100 then inc(year, 1900);
hour := grabnum;
minute := grabnum;
sec := grabnum;
datecreated := false;
try
result := encodedate(year, month, day) + encodetime(hour, minute, sec, 0);
datecreated := true;
if acton[length(acton)] in ['0'..'9'] then offset := strtoint(acton) else 
offset := gettimezone;
except
offset := 0;
if not datecreated then begin
try
result := encodedate(year, month, day);
except
result := null;
end;
end;
end;
try
if (offset <> 0) then begin
if (offset > 0) then begin
result := result - encodetime((offset div 100), (offset mod 100), 0, 0);
end else begin
result := result + encodetime((abs(offset) div 100), (abs(offset) mod 100), 0, 
0);
end;
end;
except
end;
end else begin
// old style date format - should be rare
grabmonth;
day := grabnum;
hour := grabnum;
minute := grabnum;
sec := grabnum;
year := grabnum;
if year < 100 then inc(year, 1900);
try
result := encodedate(year, month, day) + encodetime(hour, minute, sec, 0);
except
try
result := encodedate(year, month, day);
except
result := null;
end;
end;
end;
except
result := null;
end;
end else result := null;
end;


_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public
_______________________________________________
synalist-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to