Copy link to clipboard
Copied
Hello
I would like to know how to view the matched expressions in my refindcnocase string.
I have the following...
<cfset BODY = "The following message to was undeliverable. The reason for the problem: 5.1.2 - Bad destination host 'DNS Hard Error looking up dirtbagshithead.com (MX) ">
<cfset hardtest= #refindnocase("500|501|502|503|504|512|523|550|551|552|553|554|5\.0\.0|5\.0\.1|5\.0\.2|5\.0\.3|5\.0\.4|5\.1\.2|5\.2\.3|5\.5\.0|5\.5\.1|5\.5\.2|5\.5\.3|5\.5\.4|hard",body)#>
BODY is the body of an email
1. I want to see if the BODY contains any of the items in the expression.
2. If it does contain one of the expressions, i want to output which one is contained.
Please can someone assist me. I would be most grateful.
best regards
Delon
Copy link to clipboard
Copied
OK, because the matches could be varying lengths, you will need to use the returnsubexpressions option of reFind() as as to be able to find out how long the match is, so you can extract it from the source string. How it works is thoroughly documented here:
http://livedocs.adobe.com/coldfusion/8/htmldocs/functions_m-r_25.html#135102
And:
http://livedocs.adobe.com/coldfusion/8/htmldocs/regexp_11.html
Also note: you do not need to use reFindNoCase() here, as you're only matching numbers. Which intrinsically don't have a sense of case.
--
Adam
Copy link to clipboard
Copied
Hi
Thanks for the reply.
I would need to use ReFindNoCase as the last experession is "hard".
If i am incorrect, please explain..
BEst regards
Delon
Copy link to clipboard
Copied
No, you're quite right, sorry. Didn't spot that one.
--
Adam
Copy link to clipboard
Copied
Would you recommend my method?
I am trying to detect all hard bounces in a mail account using cfpop to access the account.
I cant find any other decent solution online.
Thanks again
Delon
Copy link to clipboard
Copied
It seems OK.
Is there anything in the headers of a bounced message that give a more matchable sequence? I've never looked at them. I mean like a parallel to an HTTP error scenario, in which the error screen can be customised and may or may not report the error back, but the headers will still always (?) have a 404 or a 500 or whatever in them as the response code.
I don't think an SMTP bounce message follows a standard format, does it?
--
Adam
Copy link to clipboard
Copied
Ha, your guess is as good as mine.
It is my 1st attempt at gathering SMTP errors.
But as far as I have noticed, there is no data in the headers which I can use.
Great pity!
I guess refindnocase is my best bet.
If you are interested, I can post you my code thus far, if you would like to see my attempted methodology so far.
Regards
Delon
Copy link to clipboard
Copied
Sure, post away. The ehaders thing was just speculation on my part. If you wanted to be more thorough about it... read the relevant RFC.
--
Adam