1、
//取发信时间,并且转化为系统识别的时间
stDate := TStringList.Create;
FormReceMail.NMPOP31.GetSummary(ii+1);
// FormReceMail.NMPOP31.Summary.Header.SaveToFile(sProgPath+'\temp\mysummary.txt');
// FormReceMail.NMPOP31.MailMessage.Head.SaveToFile(sProgPath+'\temp\myHeader.txt');
stDate.Assign(FormReceMail.NMPOP31.Summary.Header);
for kk := 0 to stDate.Count - 1 do
begin
if Pos('Date:',stDate.Strings[kk]) > 0 then
begin
SendDate := stDate.Strings[kk];
SendDate := TRIM(Copy(SendDate,6,Length(SendDate)));
SendDate := TRIM(Copy(SendDate,1,Pos('+0800',SendDate)-1));
SendDate := TRIM(Copy(SendDate,Pos(',',SendDate)+1,Length(SendDate)));
ssDay := Copy(SendDate,1,Pos(' ',SendDate)-1);
SendDate := Copy(SendDate,Pos(' ',SendDate)+1,Length(SendDate));
ssMonth := Copy(SendDate,1,Pos(' ',SendDate)-1);
SendDate := Copy(SendDate,Pos(' ',SendDate)+1,Length(SendDate));
ssYear := Copy(SendDate,1,Pos(' ',SendDate)-1);
SendDate := Copy(SendDate,Pos(' ',SendDate)+1,Length(SendDate));
ssTime := SendDate;
if UpperCase(ssMonth) = 'JAN' then
ssMonth := '01'
else if UpperCase(ssMonth) = 'FEB' then
ssMonth := '02'
else if UpperCase(ssMonth) = 'MAR' then
ssMonth := '03'
else if UpperCase(ssMonth) = 'APR' then
ssMonth := '04'
else if UpperCase(ssMonth) = 'MAY' then
ssMonth := '05'
else if UpperCase(ssMonth) = 'JUN' then
ssMonth := '06'
else if UpperCase(ssMonth) = 'JUL' then
ssMonth := '07'
else if UpperCase(ssMonth) = 'AUG' then
ssMonth := '08'
else if UpperCase(ssMonth) = 'SEP' then
ssMonth := '09'
else if UpperCase(ssMonth) = 'OCT' then
ssMonth := '10'
else if UpperCase(ssMonth) = 'NOV' then
ssMonth := '11'
else if UpperCase(ssMonth) = 'DEC' then
ssMonth := '12';
SendDate := ssYear + '-'+ssMonth+'-'+ssDay+' '+ssTime;
Break;
end
else
Continue;
end;
stDate.Free;2、将TNMSMTP的Charset设置为gb2312
//取发信时间,并且转化为系统识别的时间
stDate := TStringList.Create;
FormReceMail.NMPOP31.GetSummary(ii+1);
// FormReceMail.NMPOP31.Summary.Header.SaveToFile(sProgPath+'\temp\mysummary.txt');
// FormReceMail.NMPOP31.MailMessage.Head.SaveToFile(sProgPath+'\temp\myHeader.txt');
stDate.Assign(FormReceMail.NMPOP31.Summary.Header);
for kk := 0 to stDate.Count - 1 do
begin
if Pos('Date:',stDate.Strings[kk]) > 0 then
begin
SendDate := stDate.Strings[kk];
SendDate := TRIM(Copy(SendDate,6,Length(SendDate)));
SendDate := TRIM(Copy(SendDate,1,Pos('+0800',SendDate)-1));
SendDate := TRIM(Copy(SendDate,Pos(',',SendDate)+1,Length(SendDate)));
ssDay := Copy(SendDate,1,Pos(' ',SendDate)-1);
SendDate := Copy(SendDate,Pos(' ',SendDate)+1,Length(SendDate));
ssMonth := Copy(SendDate,1,Pos(' ',SendDate)-1);
SendDate := Copy(SendDate,Pos(' ',SendDate)+1,Length(SendDate));
ssYear := Copy(SendDate,1,Pos(' ',SendDate)-1);
SendDate := Copy(SendDate,Pos(' ',SendDate)+1,Length(SendDate));
ssTime := SendDate;
if UpperCase(ssMonth) = 'JAN' then
ssMonth := '01'
else if UpperCase(ssMonth) = 'FEB' then
ssMonth := '02'
else if UpperCase(ssMonth) = 'MAR' then
ssMonth := '03'
else if UpperCase(ssMonth) = 'APR' then
ssMonth := '04'
else if UpperCase(ssMonth) = 'MAY' then
ssMonth := '05'
else if UpperCase(ssMonth) = 'JUN' then
ssMonth := '06'
else if UpperCase(ssMonth) = 'JUL' then
ssMonth := '07'
else if UpperCase(ssMonth) = 'AUG' then
ssMonth := '08'
else if UpperCase(ssMonth) = 'SEP' then
ssMonth := '09'
else if UpperCase(ssMonth) = 'OCT' then
ssMonth := '10'
else if UpperCase(ssMonth) = 'NOV' then
ssMonth := '11'
else if UpperCase(ssMonth) = 'DEC' then
ssMonth := '12';
SendDate := ssYear + '-'+ssMonth+'-'+ssDay+' '+ssTime;
Break;
end
else
Continue;
end;
stDate.Free;2、将TNMSMTP的Charset设置为gb2312
第二点:请问TNMPOP3的中文显示,不是TNMSMTP