$k= "......Subject: Write the program any of your favorite language whenever if you feel
you are free
From: Vinay Kumar
To: msnjsk@gmail.com, mithunsatish@gmail.com,Susy , Steven , Mary
Content-Type: multipart/alternative; boundary=bcaec53964ec5eed2604acd0e09a
--bcaec53964ec5eed2604acd0e09a
Content-Type: text/plain; charset=ISO-8859-1
.......";
if(preg_match('/From:(?P.+)\r\n/', $k, $matches1))
{
if(preg_match('/(?P([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])' .'(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+)/', $matches1['text'],$sender ))
{
print_r($sender['from']);
}
}
if(preg_match('/To:(?P.+)\r\n/', $k, $matches2))
{
if(preg_match_all('/(?P([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])' .
'(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)+)/', $matches2['text'], $reciever))
{
if(isset($reciever['to']))
{
print_r($reciever['to']);
}
}
}得到主题:
if(preg_match('/Subject:(?P.+)\r\n/', $k, $subject))
{
print_r($subject['subject']);
}