Changeset 12297
- Timestamp:
- 12/05/2022 03:58:29 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/common.php
r11874 r12297 43 43 $from = strtolower( implode( ' ', array_filter( [ $email, ( $request->customer->fname ?? false ), ( $request->customer->lname ?? false ) ] ) ) ); 44 44 $subject_lower = strtolower( $subject ); 45 45 46 if ( 46 47 str_contains( $from, 'mail delivery' ) || 47 48 str_contains( $from, 'postmaster' ) || 48 49 str_contains( $from, 'mailer-daemon' ) || 50 str_contains( $from, 'noreply' ) || 49 51 str_contains( $subject_lower, 'undelivered mail' ) || 50 52 str_contains( $subject_lower, 'returned mail' ) || … … 52 54 str_contains( $subject_lower, 'delivery status' ) || 53 55 str_contains( $subject_lower, 'delivery report' ) || 54 str_contains( $subject_lower, 'mail delivery failed' ) 56 str_contains( $subject_lower, 'mail delivery failed' ) || 57 str_contains( $subject_lower, 'mail delivery failure' ) 55 58 ) { 59 60 56 61 // Fetch the email. 57 62 $email_obj = Helpscout_API::api( '/v2/conversations/' . $request->ticket->id . '?embed=threads' ); … … 67 72 // Extract `To:`, `X-Orig-To:`, and fallback to all emails. 68 73 $emails = []; 69 if ( preg_match( '!^(x-orig-to:|to: )\s*(.+@.+)$!im', $email_body, $m ) ) {70 $m[ 2] = str_replace( [ '<', '>' ], '', $m[2] );71 $m[ 2] = trim( $m[2], '<> ' );74 if ( preg_match( '!^(x-orig-to:|to:|Final-Recipient:(\s*rfc\d+;)?)\s*(?P<email>.+@.+)$!im', $email_body, $m ) ) { 75 $m['email'] = str_replace( [ '<', '>' ], '', $m['email'] ); 76 $m['email'] = trim( $m['email'], '<> ' ); 72 77 73 $emails = [ $m[ 2] ];78 $emails = [ $m['email'] ]; 74 79 } else { 75 80 // Ugly regex for emails, but it's good for mailer-daemon emails.
Note: See TracChangeset
for help on using the changeset viewer.