Jump to content

Recommended Posts

I'm working on bounce processing and I need some trying to get the bounce error message.

 

My pattern matching is terrible so I need some help with what should be a simple pattern.

 

Here is an example bounce message body:

Hi. This is the qmail-send program at yyyyy.xxxx.com.

I'm afraid I wasn't able to deliver your message to the following addresses.

This is a permanent error; I've given up. Sorry it didn't work out.

 

<email_address>:

Connected to ip_address but sender was rejected.

Remote host said: 550 SC-001 Mail rejected by Windows Live Hotmail for policy reasons. Reasons for rejection may be related to content with spam-like characteristics or IP/domain reputation problems. If you are not an email/network admin please contact your E-mail/Internet Service Provider for help. Email/network admins, please visit http://postmaster.live.com for email delivery information and support

 

--- Below this line is a copy of the message.

...

etc

...

 

I basically need everything in between "<email_address>:" and "--- Below this line is a copy of the message."

 

I tried:

eregi("^<email_address>*.)--- Below this line is a copy of the message.$",$body,$matches);

 

But I was keep getting this error: Warning: eregi() [function.eregi]: REG_BADRPT

 

I assuming because my pattern is bad.

 

Any help is appreciated.

 

Thanks.

 

 

Eregi is deprecated, use preg_match and add delimiters to the start and end of your expression. Furthermore the problem is your adding ^ and $, which woul'dnt work as its not the start and end of the string your trying to match (in this case $body)

 

Also escape the dot and dashes as they are considered special characters in regex.

 

Try the following:

 

preg_match("~<email_address>.*)\-\-\- Below this line is a copy of the message\.~Us",$body,$matches);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.