将你贴出来的内容,保存为一个文本文件,<br>然后运行以下的代码就会解决。<br>当然关键字符要完全匹配。<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> s:TStrings;<br> s1,s2,s3,sf,Cr:string;<br> i,n:integer;<br>begin<br> cR:=#13#10;<br> s:=TStringList.Create ;<br> sf:='邮件服务器:';<br> s2:='';<br> s.LoadFromFile ('d:/temp/delphi/dd.txt');<br> for i:=0 to s.count-1 do<br> begin<br> s1:=trim(s.Strings);<br> if copy(s1,1,2)='by' then<br> begin<br> n:=pos(' with ',s1);<br> sf:=sf+' '+copy(s1,4,n-4);<br> continue;<br> end;<br><br> if copy(s1,1,8)='Subject:' then<br> begin<br> s2:=s2+'主题:'+trim(copy(s1,9,length(s1)-8))+Cr;<br> continue;<br> end;<br><br> if copy(s1,1,5)='From:' then<br> begin<br> s1:=trim(copy(s1,6,length(s1)-5));<br> n:=pos('<',s1)+1;<br> s2:=s2+'发信人地址:'+copy(s1,n,length(s1)-n)+Cr;<br> s1:=copy(s1,2,n-4);<br> s2:=s2+'发信人姓名:'+s1+Cr;<br> continue;<br> end;<br><br> end;<br> s.free;<br> s2:=s2+sf;<br> showmessage(s2);<br><br>end;<br>