I am trying to fetch some information from the email header. I am piping the mail to my script and want to fetch the particular content from the header but I am having difficulties to fetch it.
My seacrh string is as given below.
my $test = '(From) (S*@*S*)(s*)(S*s*S*s*S*s*S*s*S*)(s*)(.*)(s*)(id)(s*)(wwwwww-wwwwww-ww*)(s*)(for email@domain_name.com)(s*)(;)(s*)(S*s*S*s*S*s*S*)(s*)(dd:dd:dd)(.*)(s*)(Subject:)(s*)(.*)(s*)(From:|Message-Id:)(s*)(.*)';
It is working well if mail header does not have any one value in it out of (From:|Message-Id:) but if the mail header have both of them then it is printing the Subject line along with the Message_Id or From: which ever is there in the header first.
For example I am getting the Subject line as below :
Subject=>test from test email ID Message-Id:
I want to select only subject filed. Is there any way to strip both of them using the regex.
I also want to know if there is any way to replace new line character with string in a multi-line string.
I tried to replace with it space and it is working but if I am trying it with string such as $$$$$ or :::: my script is not executing itself.
0 · ·