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
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
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
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
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:
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);
}
}