Hello,<br>I have a perl script that looks at a users mailbox (var/spool/mail/USERNAME) and takes a message extracts the To, From, CC, BCC, Subject, and Message out and enters them as a comment in a database. The script looks for the email address in the To field by extracting everything between qoutes (" "
.<br>Which works great for email sent from Lotus Notes [4.6] as that is the format Notes uses. Unfortunatly, MS Outlook does not use quotes in that field. So all email sent from Outlook is ignored. What I am looking for is any help that will allow me to change the script to look for quotes OR anything after FROM: so that all email will be processed the same. I have included the section of script I am referring to at the bottom of this post. Thanks VERY much in advance for any and all help on this. It has been a huge source of frustration for me and the company I work for.<br>TIA!<br>-Jim<br>---Begin Code Section---<br>foreach(@mbox) {<br>foreach(@$_) {<br>if ($current_key eq "contents"
{<br>if ($_=~m"Content-Disposition: attachment"
{<br>$bad=1;<br>}<br>if (!$bad) {<br>if (exists($message{$current_key})) {<br>$message{$current_key}="$message{$current_key} $_";<br>} else {<br>$message{$current_key}=$_;<br>}<br>}<br>} else {<br>@pieces=split(': ',$_,2);<br>if ($pieces[1] ne ""
{ # Is this a unique entry or a continuation of the previous<br>$current_key=$pieces[0];<br>if (($current_key eq "Content-Type"
¦ ¦ ($current_key eq "Content-Disposition"
) {<br>$current_key="contents";<br>}<br>chomp($pieces[1]);<br>if (exists($message{$current_key})) {<br>$message{$current_key} = "$message{$current_key} $pieces[1]";<br>} else {<br>$message{$current_key}="$pieces[1]";<br>}<br>} else {<br>chomp($pieces[0]);<br>if (($current_key eq "To"
¦ ¦($current_key eq "cc"
¦ ¦($current_key eq "Subject"
) {<br>$result=($pieces[0]=~s" ""g);<br>}<br>if (exists($message{$current_key})) {<br>$message{$current_key} = "$message{$current_key} $pieces[0]";<br>} else {<br>$message{$current_key}="$pieces[0]";<br>}<br>}<br>}<br>}<br># We need to remove the extraneous information from the addressing fields<br>@tmp=split('"',$message{'From'});<br>$message{'From'}=$tmp[1];<br><br>if ($message{'To'}=~m"<"
{<br>@tmp=split(',',$message{'To'});<br><br>foreach(@tmp) {<br>@tmp2=split('<',$_,2);<br>@tmp3=split('>',$tmp2[1],2);<br>$_=@tmp3[0];<br>}<br>$message{'To'}=join(',',@tmp);<br>}<br>if ($message{'cc'}) {<br>@tmp=split(',',$message{'cc'});<br>foreach(@tmp) {<br>@tmp2=split('<',$_,2);<br>@tmp3=split('>',$tmp2[1],2);<br>$_=@tmp3[0];<br>}<br>$message{'cc'}=join(',',@tmp);<br>} else {<br>$message{'cc'}=" ";<br>}<br># Date needs to be corrected to the dd-Mon-yyyy format<br>$result=($message{'Date'}=~s"([0-9]) (...) ([0-9])"$1-$2-$3"
;<br>@tmp=split(' ',$message{'Date'});<br>$message{'Date'}=$tmp[1];<br># Contents and subject must be escaped<br>$result=($message{'Subject'}=~s"'"''"g);<br>$result=($message{'Subject'}=~s"`"``"g);<br>$result=($message{'contents'}=~s"'"''"g);<br>$result=($message{'contents'}=~s"`"``"g);<br>$result=($message{'contents'}=~s"\\"\\\\"g);<br>@tmp=split(' ',$message{'Subject'});<br>$catno="";<br>foreach(@tmp) {<br>if ($_=~m"[0-9]-"
{<br>$catno=$_;<br>}<br>}<br><br>$sent=$message{'Date'};<br>$subject=$message{'Subject'};<br>$whofrom=$message{'From'};<br>$sendto=$message{'To'};<br>$cc=$message{'cc'};<br>$contents=$message{'contents'};<br>---End Code Section---<br>