email parsing automation

Email Parser

Extract data from emails and automate your workflow

The forum is now read only. Please, go to the the main Email Parser website if you need help.
Need help configuring the program? Have any questions regarding its use?
Hello there,

I would like to know how to achieve or clean the CC or BCC fields.
My scenario is something like this:

I received a mail with CC data
--------------------------------------------------------------
"Kristine" <kristine@gmail.com>
"Pepe" <pepe@gmail.com>
jutek@hotmail.com
pakwal@yahoo.com
boombox@gmail.com
rapidtech@rapidtech.com
info@miniphone.com
raymisterio@yahoo.com
"Shaggy Dog" <shaggydog@gmail.com>
--------------------------------------------------------------
EXPECTED RESULT
--------------------------------------------------------------
kristine@gmail.com,
pepe@gmail.com,
jutek@hotmail.com,
pakwal@yahoo.com,
boombox@gmail.com,
rapidtech@rapidtech.com,
info@miniphone.com,
raymisterio@yahoo.com,
shaggydog@gmail.com
--------------------------------------------------------------


Thanks in advance.

Cheers,

Sigmund
Hi Sigmund,

You have to use the following regular expression to separate the email address from the rest of the text in the CC field:

([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})

The attached screenshots show how it is used. You have to click on them to see the image in its full size
Attachments
1.png
2.png
Hello,

Thank you for your response.
I tried the regular expression that you provided ([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})
but it only gives me single email which is kristine@gmail.com.

--------------------------------------------------------------
MY EXPECTED RESULT AND SEPARATED BY COMMA
--------------------------------------------------------------
kristine@gmail.com,
pepe@gmail.com,
jutek@hotmail.com,
pakwal@yahoo.com,
boombox@gmail.com,
rapidtech@rapidtech.com,
info@miniphone.com,
raymisterio@yahoo.com,
shaggydog@gmail.com
--------------------------------------------------------------


Cheers,

Sigmund
Hi Sigmund,

You need a script for merging all the CC_cleaned values into one:


using System;
using System.Text;
using System.IO;
using System.Net.Mail;
using System.Collections.Specialized;
using EmailParserBackend.ScriptingInterface;

public class MyAction : ScriptBasedAction
{
// Implement this method with your own code. Run() will be called each time
// this Action runs
public override bool Run(MailMessage email, NameValueCollection fields)
{
string output="";
foreach(string value in fields.GetValues("CC_cleaned"))
output+=value+",\r\n";

fields.Add("Merged_CC_values", output.Trim(new char[]{',','\n','\r'}));

return (true);
}
}
Attachments
script_to_merge_values_into_one.png
CC_field.png
CC_cleaned_field.png
result_mergin_multiple_values_into_one_comma_separated.png