Could we help you? Please click the banners. We are young and desperately need the money
We are sending out mass e-mails (bulk mails) and we will return some rejection errors - almost certainly. In many cases this is handled by a bulk mailing application for you. But in some cases you might just have access to your clients e-mail account containing hundrets or thousands of those rejection e-mails. The question now is: How do you manage to export all the addresses of these rejected e-mails into one CSV file (list), that enabled you to insert those addresses into your address list database to handle exclusions/deletions? Well we just had this issue and this is how we solved it:
.*?Final-Recipient.*?(?:rfc822;\s*<|rfc822;\s*)([a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*).*?(?=(Final-Recipient)|\z)
.*?(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}))|(?:.*?\z)
$1\r\n
If you like addresses to be separated by comma or semikolon:
$1,
Find other useful REGEX functions here: https://www.lexo.ch/blog/tag/regex/