(REF) civicrm_data - Extract civicrm_mailing_bounce_type and civicrm_mailing_bounce_p...
authorTim Otten <totten@civicrm.org>
Fri, 19 May 2023 09:29:16 +0000 (02:29 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 19 May 2023 09:29:16 +0000 (02:29 -0700)
13 files changed:
CRM/Core/CodeGen/BounceType.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/AOL.sqldata.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/Away.sqldata.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/Dns.sqldata.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/Host.sqldata.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/Inactive.sqldata.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/Invalid.sqldata.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/Loop.sqldata.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/Quota.sqldata.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/Relay.sqldata.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/Spam.sqldata.php [new file with mode: 0644]
sql/civicrm_data/civicrm_mailing_bounce_type/Syntax.sqldata.php [new file with mode: 0644]
xml/templates/civicrm_data.tpl

diff --git a/CRM/Core/CodeGen/BounceType.php b/CRM/Core/CodeGen/BounceType.php
new file mode 100644 (file)
index 0000000..64f342c
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+
+class CRM_Core_CodeGen_BounceType extends CRM_Core_CodeGen_AbstractSqlData {
+
+  /**
+   * OptionGroup properties.
+   *
+   * @var array
+   * @internal
+   */
+  protected $metadata = [];
+
+  protected $var;
+
+  public static function create(string $name): CRM_Core_CodeGen_BounceType {
+    $og = new static();
+    $og->metadata['name'] = $name;
+    $og->var = '@bounceTypeID';
+    return $og;
+  }
+
+  /**
+   * @param array $fields
+   *  List of BounceType fields/values.
+   *  Ex: ['is_reserved' => 0, 'description' => 'Store the stuff']
+   * @return $this
+   */
+  public function addMetadata(array $fields): CRM_Core_CodeGen_BounceType {
+    $this->metadata = array_merge($this->metadata, $fields);
+    return $this;
+  }
+
+  public function toArray(): array {
+    $result = [];
+    foreach ($this->rows as $row) {
+      $row = $this->applySyncRules($row);
+      $result[] = array_merge(['bounce_type_id' => new CRM_Utils_SQL_Literal($this->var)], $this->defaults, $row);
+    }
+    return $result;
+  }
+
+  public function toSQL(): string {
+    $result = '';
+    $result .= CRM_Utils_SQL_Insert::into('civicrm_mailing_bounce_type')
+      ->row($this->metadata)
+      ->toSQL() . ";\n";
+
+    $rows = $this->toArray();
+    if ($rows) {
+      $result .= CRM_Utils_SQL_Select::from('civicrm_mailing_bounce_type')
+        ->select("{$this->var} := max(id)")
+        ->where('name = @NAME', ['NAME' => $this->metadata['name']])
+        ->toSQL() . ";\n";
+
+      $result .= CRM_Utils_SQL_Insert::into('civicrm_mailing_bounce_pattern')
+        ->allowLiterals()
+        ->rows($rows)
+        ->toSQL() . ";\n";
+    }
+    return $result;
+  }
+
+}
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/AOL.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/AOL.sqldata.php
new file mode 100644 (file)
index 0000000..c22d64b
--- /dev/null
@@ -0,0 +1,9 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('AOL')
+  ->addMetadata([
+    'description' => ts('AOL Terms of Service complaint'),
+    'hold_threshold' => 1,
+  ])
+  ->addValueTable(['pattern'], [
+    ['Client TOS Notification'],
+  ]);
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/Away.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/Away.sqldata.php
new file mode 100644 (file)
index 0000000..8e50863
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('Away')
+  ->addMetadata([
+    'description' => ts('Recipient is on vacation'),
+    'hold_threshold' => 30,
+  ])
+  ->addValueTable(['pattern'], [
+    ['(be|am)? (out of|away from) (the|my)? (office|computer|town)'],
+    ['i am on vacation'],
+  ]);
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/Dns.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/Dns.sqldata.php
new file mode 100644 (file)
index 0000000..1bdb64d
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('Dns')
+  ->addMetadata([
+    'description' => ts('Unable to resolve recipient domain'),
+    'hold_threshold' => 3,
+  ])
+  ->addValueTable(['pattern'], [
+    ['name(server entry| lookup failure)'],
+    ['no (mail server|matches to nameserver query|dns entries)'],
+    ['reverse dns entry'],
+    ['Host or domain name not found'],
+    ['Unable to resolve MX record for'],
+  ]);
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/Host.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/Host.sqldata.php
new file mode 100644 (file)
index 0000000..916cefc
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('Host')
+  ->addMetadata([
+    // FIXME: Typo
+    'description' => ts('Unable to deliver to destintation mail server'),
+    // 'description' => ts('Unable to deliver to destination mail server'),
+    'hold_threshold' => 3,
+  ])
+  ->addValueTable(['pattern'], [
+    ['(unknown|not local) host'],
+    ['all hosts have been failing'],
+    ['allowed rcpthosts'],
+    ['connection (refused|timed out)'],
+    ['not connected'],
+    ['couldn\'t find any host named'],
+    ['error involving remote host'],
+    ['host unknown'],
+    ['invalid host name'],
+    ['isn\'t in my control/locals file'],
+    ['local configuration error'],
+    ['not a gateway'],
+    ['server is (down or unreachable|not responding)'],
+    ['too many connections'],
+    ['unable to connect'],
+    ['lost connection'],
+    ['conversation with [^ ]* timed out while'],
+    ['server requires authentication'],
+    ['authentication (is )?required'],
+  ]);
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/Inactive.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/Inactive.sqldata.php
new file mode 100644 (file)
index 0000000..aa45415
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('Inactive')
+  ->addMetadata([
+    'description' => ts('User account is no longer active'),
+    'hold_threshold' => 1,
+  ])
+  ->addValueTable(['pattern'], [
+    ['(my )?e-?mail( address)? has changed'],
+    ['account (inactive|expired|deactivated)'],
+    ['account is locked'],
+
+    // FIXME: In the old SQL, the "\" in "\w" didn't get through. We're probably loading the wrong data.
+    // ['changed \w+( e-?mail)? address'],
+    ['changed w+( e-?mail)? address'],
+
+    ['deactivated mailbox'],
+    ['disabled or discontinued'],
+    ['inactive user'],
+    ['is inactive on this domain'],
+    ['mail receiving disabled'],
+    ['mail( ?)address is administrative?ly disabled'],
+    ['mailbox (temporarily disabled|currently suspended)'],
+    ['no longer (accepting mail|on server|in use|with|employed|on staff|works for|using this account)'],
+    ['not accepting (mail|messages)'],
+    ['please use my new e-?mail address'],
+    ['this address no longer accepts mail'],
+    ['user account suspended'],
+    ['account that you tried to reach is disabled'],
+    ['User banned'],
+  ]);
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/Invalid.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/Invalid.sqldata.php
new file mode 100644 (file)
index 0000000..86828e4
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('Invalid')
+  ->addMetadata([
+    'description' => ts('Email address is not valid'),
+    'hold_threshold' => 1,
+  ])
+  ->addValueTable(['pattern'], [
+    ['(user|recipient( name)?) is not recognized'],
+    ['554 delivery error'],
+    ['address does not exist'],
+    ['address(es)?( you (entered|specified))? (could|was)( not|n.t)( be)? found'],
+    ['address(ee)? (unknown|invalid)'],
+    ['bad destination'],
+    ['badly formatted address'],
+    ['can\'t open mailbox for'],
+    ['cannot deliver'],
+    ['delivery to the following recipient(s)? failed'],
+    ['destination addresses were unknown'],
+    ['did not reach the following recipient'],
+    ['does not exist'],
+    ['does not like recipient'],
+    ['does not specify a valid notes mail file'],
+    ['illegal alias'],
+    ['invalid (mailbox|(e-?mail )?address|recipient|final delivery)'],
+    ['invalid( or unknown)?( virtual)? user'],
+    ['(mail )?delivery (to this user )?is not allowed'],
+    ['mailbox (not found|unavailable|name not allowed)'],
+    ['message could not be forwarded'],
+    ['missing or malformed local(-| )part'],
+    ['no e-?mail address registered'],
+    ['no such (mail drop|mailbox( \\w+)?|(e-?mail )?address|recipient|(local )?user|person)( here)?'],
+    ['no mailbox (here )?by that name'],
+    ['not (listed in|found in directory|known at this site|our customer)'],
+    ['not a valid( (user|mailbox))?'],
+    ['not present in directory entry'],
+    ['recipient (does not exist|(is )?unknown|rejected|denied|not found)'],
+    ['this user doesn\'t have a yahoo.com address'],
+    ['unavailable to take delivery of the message'],
+    ['unavailable mailbox'],
+    ['unknown (local( |-)part|recipient|address error)'],
+    ['unknown( or illegal)? user( account)?'],
+    ['unrecognized recipient'],
+    ['unregistered address'],
+    ['user (unknown|(does not|doesn\'t) exist)'],
+
+    // FIXME: In the old SQL, the "\" in "\w" didn't get through. We're probably loading the wrong data.
+    // ['user doesn\'t have an? \w+ account'],
+    ['user doesn\'t have an? w+ account'],
+
+    ['user(\'s e-?mail name is)? not found'],
+    ['^Validation failed for:'],
+    ['5.1.0 Address rejected'],
+    ['no valid recipients?'],
+    ['RecipNotFound'],
+    ['no one at this address'],
+    ['misconfigured forwarding address'],
+    ['account is not allowed'],
+    ['Address .<[^>]*>. not known here'],
+    ['Recipient address rejected: ([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}'],
+    ['Non sono riuscito a trovare l.indirizzo e-mail'],
+    ['nadie con esta direcci..?n'],
+    ['ni bilo mogo..?e najti prejemnikovega e-po..?tnega naslova'],
+    ['Elektronski naslov (je ukinjen|ne obstaja)'],
+    ['nepravilno nastavljen predal'],
+  ]);
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/Loop.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/Loop.sqldata.php
new file mode 100644 (file)
index 0000000..a1e9ca9
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('Loop')
+  ->addMetadata([
+    'description' => ts('Mail routing error'),
+    'hold_threshold' => 3,
+  ])
+  ->addValueTable(['pattern'], [
+    ['(mail( forwarding)?|routing).loop'],
+    ['excessive recursion'],
+    ['loop detected'],
+    ['maximum hop count exceeded'],
+    ['message was forwarded more than the maximum allowed times'],
+    ['too many (hops|recursive forwards)'],
+  ]);
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/Quota.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/Quota.sqldata.php
new file mode 100644 (file)
index 0000000..d1ab5d8
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('Quota')
+  ->addMetadata([
+    'description' => ts('User inbox is full'),
+    'hold_threshold' => 3,
+  ])
+  ->addValueTable(['pattern'], [
+    ['(disk(space)?|over the allowed|exceed(ed|s)?|storage) quota'],
+    ['522_mailbox_full'],
+    ['exceeds allowed message count'],
+    ['file too large'],
+    ['full mailbox'],
+    ['(mail|in)(box|folder) ((for user \\w+ )?is )?full'],
+    ['mailbox (has exceeded|is over) the limit'],
+    ['mailbox( exceeds allowed)? size'],
+    ['no space left for this user'],
+    ['over\\s?quota'],
+    ['quota (for the mailbox )?has been exceeded'],
+    ['quota ?(usage|violation|exceeded)'],
+    ['recipient storage full'],
+    ['not able to receive more mail'],
+    ['doesn.t have enough disk space left'],
+    ['exceeded storage allocation'],
+    ['running out of disk space'],
+  ]);
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/Relay.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/Relay.sqldata.php
new file mode 100644 (file)
index 0000000..f7ba738
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('Relay')
+  ->addMetadata([
+    'description' => ts('Unable to reach destination mail server'),
+    'hold_threshold' => 3,
+  ])
+  ->addValueTable(['pattern'], [
+    ['cannot find your hostname'],
+    ['ip name lookup'],
+    ['not configured to relay mail'],
+    ['relay(ing)? (not permitted|(access )?denied)'],
+    ['relayed mail to .+? not allowed'],
+    ['sender ip must resolve'],
+    ['unable to relay'],
+    ['No route to host'],
+    ['Network is unreachable'],
+    ['unrouteable address'],
+    ['We don.t handle mail for'],
+    ['we do not relay'],
+    ['Rejected by next-hop'],
+    ['not permitted to( *550)? relay through this server'],
+  ]);
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/Spam.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/Spam.sqldata.php
new file mode 100644 (file)
index 0000000..a68a52d
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('Spam')
+  ->addMetadata([
+    'description' => ts('Message caught by a content filter'),
+    'hold_threshold' => 1,
+  ])
+  ->addValueTable(['pattern'], [
+    ['(bulk( e-?mail)|content|attachment blocking|virus|mail system) filters?'],
+    ['(hostile|questionable|unacceptable) content'],
+    ['address .+? has not been verified'],
+
+    // FIXME: In the old SQL, the "\" in "\w" didn't get through. We're probably loading the wrong data.
+    // ['anti-?spam (polic\w+|software)'],
+    ['anti-?spam (policw+|software)'],
+
+    ['anti-?virus gateway has detected'],
+    ['blacklisted'],
+    ['blocked message'],
+    ['content control'],
+    ['delivery not authorized'],
+    ['does not conform to our e-?mail policy'],
+    ['excessive spam content'],
+    ['message looks suspicious'],
+    ['open relay'],
+    ['sender was rejected'],
+    ['spam(check| reduction software| filters?)'],
+    ['blocked by a user configured filter'],
+    ['(detected|rejected) (as|due to) spam'],
+    ['X-HmXmrOriginalRecipient'],
+    ['Client host .[^ ]*. blocked'],
+    ['automatic(ally-generated)? messages are not accepted'],
+    ['denied by policy'],
+    ['has no corresponding reverse \\(PTR\\) address'],
+    ['has a policy that( [^ ]*)? prohibited the mail that you sent'],
+    ['is likely unsolicited mail'],
+    ['Local Policy Violation'],
+    ['ni bilo mogo..?e dostaviti zaradi varnostnega pravilnika'],
+    ['abuse report'],
+  ]);
diff --git a/sql/civicrm_data/civicrm_mailing_bounce_type/Syntax.sqldata.php b/sql/civicrm_data/civicrm_mailing_bounce_type/Syntax.sqldata.php
new file mode 100644 (file)
index 0000000..a2ddd20
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+return CRM_Core_CodeGen_BounceType::create('Syntax')
+  ->addMetadata([
+    'description' => ts('Error in SMTP transaction'),
+    'hold_threshold' => 3,
+  ])
+  ->addValueTable(['pattern'], [
+    ['nonstandard smtp line terminator'],
+    ['syntax error in from address'],
+    ['unknown smtp code'],
+  ]);
index 8891e1a95b2d6cefa51f8a24571faa780c2811e1..e9b4cba6882f0a5f2eae85db264a92dca0ca7ea7 100644 (file)
@@ -145,269 +145,17 @@ VALUES (@drgid, 'civicrm_contact', 'first_name',     '5'),
 {php}echo (include "sql/civicrm_data/civicrm_county.sqldata.php")->toSQL();{/php}
 
 -- Bounce classification patterns
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('AOL', '{ts escape="sql"}AOL Terms of Service complaint{/ts}', 1);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'AOL';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, 'Client TOS Notification');
-
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('Away', '{ts escape="sql"}Recipient is on vacation{/ts}', 30);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Away';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, '(be|am)? (out of|away from) (the|my)? (office|computer|town)'),
-    (@bounceTypeID, 'i am on vacation');
-
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('Dns', '{ts escape="sql"}Unable to resolve recipient domain{/ts}', 3);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Dns';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, 'name(server entry| lookup failure)'),
-    (@bounceTypeID, 'no (mail server|matches to nameserver query|dns entries)'),
-    (@bounceTypeID, 'reverse dns entry'),
-    (@bounceTypeID, 'Host or domain name not found'),
-    (@bounceTypeID, 'Unable to resolve MX record for');
-
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('Host', '{ts escape="sql"}Unable to deliver to destintation mail server{/ts}', 3);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Host';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, '(unknown|not local) host'),
-    (@bounceTypeID, 'all hosts have been failing'),
-    (@bounceTypeID, 'allowed rcpthosts'),
-    (@bounceTypeID, 'connection (refused|timed out)'),
-    (@bounceTypeID, 'not connected'),
-    (@bounceTypeID, 'couldn\'t find any host named'),
-    (@bounceTypeID, 'error involving remote host'),
-    (@bounceTypeID, 'host unknown'),
-    (@bounceTypeID, 'invalid host name'),
-    (@bounceTypeID, 'isn\'t in my control/locals file'),
-    (@bounceTypeID, 'local configuration error'),
-    (@bounceTypeID, 'not a gateway'),
-    (@bounceTypeID, 'server is (down or unreachable|not responding)'),
-    (@bounceTypeID, 'too many connections'),
-    (@bounceTypeID, 'unable to connect'),
-    (@bounceTypeID, 'lost connection'),
-    (@bounceTypeID, 'conversation with [^ ]* timed out while'),
-    (@bounceTypeID, 'server requires authentication'),
-    (@bounceTypeID, 'authentication (is )?required');
-
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('Inactive', '{ts escape="sql"}User account is no longer active{/ts}', 1);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Inactive';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, '(my )?e-?mail( address)? has changed'),
-    (@bounceTypeID, 'account (inactive|expired|deactivated)'),
-    (@bounceTypeID, 'account is locked'),
-    (@bounceTypeID, 'changed \w+( e-?mail)? address'),
-    (@bounceTypeID, 'deactivated mailbox'),
-    (@bounceTypeID, 'disabled or discontinued'),
-    (@bounceTypeID, 'inactive user'),
-    (@bounceTypeID, 'is inactive on this domain'),
-    (@bounceTypeID, 'mail receiving disabled'),
-    (@bounceTypeID, 'mail( ?)address is administrative?ly disabled'),
-    (@bounceTypeID, 'mailbox (temporarily disabled|currently suspended)'),
-    (@bounceTypeID, 'no longer (accepting mail|on server|in use|with|employed|on staff|works for|using this account)'),
-    (@bounceTypeID, 'not accepting (mail|messages)'),
-    (@bounceTypeID, 'please use my new e-?mail address'),
-    (@bounceTypeID, 'this address no longer accepts mail'),
-    (@bounceTypeID, 'user account suspended'),
-    (@bounceTypeID, 'account that you tried to reach is disabled'),
-    (@bounceTypeID, 'User banned');
-
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('Invalid', '{ts escape="sql"}Email address is not valid{/ts}', 1);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Invalid';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, '(user|recipient( name)?) is not recognized'),
-    (@bounceTypeID, '554 delivery error'),
-    (@bounceTypeID, 'address does not exist'),
-    (@bounceTypeID, 'address(es)?( you (entered|specified))? (could|was)( not|n.t)( be)? found'),
-    (@bounceTypeID, 'address(ee)? (unknown|invalid)'),
-    (@bounceTypeID, 'bad destination'),
-    (@bounceTypeID, 'badly formatted address'),
-    (@bounceTypeID, 'can\'t open mailbox for'),
-    (@bounceTypeID, 'cannot deliver'),
-    (@bounceTypeID, 'delivery to the following recipient(s)? failed'),
-    (@bounceTypeID, 'destination addresses were unknown'),
-    (@bounceTypeID, 'did not reach the following recipient'),
-    (@bounceTypeID, 'does not exist'),
-    (@bounceTypeID, 'does not like recipient'),
-    (@bounceTypeID, 'does not specify a valid notes mail file'),
-    (@bounceTypeID, 'illegal alias'),
-    (@bounceTypeID, 'invalid (mailbox|(e-?mail )?address|recipient|final delivery)'),
-    (@bounceTypeID, 'invalid( or unknown)?( virtual)? user'),
-    (@bounceTypeID, '(mail )?delivery (to this user )?is not allowed'),
-    (@bounceTypeID, 'mailbox (not found|unavailable|name not allowed)'),
-    (@bounceTypeID, 'message could not be forwarded'),
-    (@bounceTypeID, 'missing or malformed local(-| )part'),
-    (@bounceTypeID, 'no e-?mail address registered'),
-    (@bounceTypeID, 'no such (mail drop|mailbox( \\w+)?|(e-?mail )?address|recipient|(local )?user|person)( here)?'),
-    (@bounceTypeID, 'no mailbox (here )?by that name'),
-    (@bounceTypeID, 'not (listed in|found in directory|known at this site|our customer)'),
-    (@bounceTypeID, 'not a valid( (user|mailbox))?'),
-    (@bounceTypeID, 'not present in directory entry'),
-    (@bounceTypeID, 'recipient (does not exist|(is )?unknown|rejected|denied|not found)'),
-    (@bounceTypeID, 'this user doesn\'t have a yahoo.com address'),
-    (@bounceTypeID, 'unavailable to take delivery of the message'),
-    (@bounceTypeID, 'unavailable mailbox'),
-    (@bounceTypeID, 'unknown (local( |-)part|recipient|address error)'),
-    (@bounceTypeID, 'unknown( or illegal)? user( account)?'),
-    (@bounceTypeID, 'unrecognized recipient'),
-    (@bounceTypeID, 'unregistered address'),
-    (@bounceTypeID, 'user (unknown|(does not|doesn\'t) exist)'),
-    (@bounceTypeID, 'user doesn\'t have an? \w+ account'),
-    (@bounceTypeID, 'user(\'s e-?mail name is)? not found'),
-    (@bounceTypeID, '^Validation failed for:'),
-    (@bounceTypeID, '5.1.0 Address rejected'),
-    (@bounceTypeID, 'no valid recipients?'),
-    (@bounceTypeID, 'RecipNotFound'),
-    (@bounceTypeID, 'no one at this address'),
-    (@bounceTypeID, 'misconfigured forwarding address'),
-    (@bounceTypeID, 'account is not allowed'),
-    (@bounceTypeID, 'Address .<[^>]*>. not known here'),
-    (@bounceTypeID, '{literal}Recipient address rejected: ([a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}{/literal}'),
-    (@bounceTypeID, 'Non sono riuscito a trovare l.indirizzo e-mail'),
-    (@bounceTypeID, 'nadie con esta direcci..?n'),
-    (@bounceTypeID, 'ni bilo mogo..?e najti prejemnikovega e-po..?tnega naslova'),
-    (@bounceTypeID, 'Elektronski naslov (je ukinjen|ne obstaja)'),
-    (@bounceTypeID, 'nepravilno nastavljen predal');
-
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('Loop', '{ts escape="sql"}Mail routing error{/ts}', 3);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Loop';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, '(mail( forwarding)?|routing).loop'),
-    (@bounceTypeID, 'excessive recursion'),
-    (@bounceTypeID, 'loop detected'),
-    (@bounceTypeID, 'maximum hop count exceeded'),
-    (@bounceTypeID, 'message was forwarded more than the maximum allowed times'),
-    (@bounceTypeID, 'too many (hops|recursive forwards)');
-
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('Quota', '{ts escape="sql"}User inbox is full{/ts}', 3);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Quota';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, '(disk(space)?|over the allowed|exceed(ed|s)?|storage) quota'),
-    (@bounceTypeID, '522_mailbox_full'),
-    (@bounceTypeID, 'exceeds allowed message count'),
-    (@bounceTypeID, 'file too large'),
-    (@bounceTypeID, 'full mailbox'),
-    (@bounceTypeID, '(mail|in)(box|folder) ((for user \\w+ )?is )?full'),
-    (@bounceTypeID, 'mailbox (has exceeded|is over) the limit'),
-    (@bounceTypeID, 'mailbox( exceeds allowed)? size'),
-    (@bounceTypeID, 'no space left for this user'),
-    (@bounceTypeID, 'over\\s?quota'),
-    (@bounceTypeID, 'quota (for the mailbox )?has been exceeded'),
-    (@bounceTypeID, 'quota ?(usage|violation|exceeded)'),
-    (@bounceTypeID, 'recipient storage full'),
-    (@bounceTypeID, 'not able to receive more mail'),
-    (@bounceTypeID, 'doesn.t have enough disk space left'),
-    (@bounceTypeID, 'exceeded storage allocation'),
-    (@bounceTypeID, 'running out of disk space');
-
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('Relay', '{ts escape="sql"}Unable to reach destination mail server{/ts}', 3);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Relay';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, 'cannot find your hostname'),
-    (@bounceTypeID, 'ip name lookup'),
-    (@bounceTypeID, 'not configured to relay mail'),
-    (@bounceTypeID, 'relay(ing)? (not permitted|(access )?denied)'),
-    (@bounceTypeID, 'relayed mail to .+? not allowed'),
-    (@bounceTypeID, 'sender ip must resolve'),
-    (@bounceTypeID, 'unable to relay'),
-    (@bounceTypeID, 'No route to host'),
-    (@bounceTypeID, 'Network is unreachable'),
-    (@bounceTypeID, 'unrouteable address'),
-    (@bounceTypeID, 'We don.t handle mail for'),
-    (@bounceTypeID, 'we do not relay'),
-    (@bounceTypeID, 'Rejected by next-hop'),
-    (@bounceTypeID, 'not permitted to( *550)? relay through this server');
-
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('Spam', '{ts escape="sql"}Message caught by a content filter{/ts}', 1);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Spam';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, '(bulk( e-?mail)|content|attachment blocking|virus|mail system) filters?'),
-    (@bounceTypeID, '(hostile|questionable|unacceptable) content'),
-    (@bounceTypeID, 'address .+? has not been verified'),
-    (@bounceTypeID, 'anti-?spam (polic\w+|software)'),
-    (@bounceTypeID, 'anti-?virus gateway has detected'),
-    (@bounceTypeID, 'blacklisted'),
-    (@bounceTypeID, 'blocked message'),
-    (@bounceTypeID, 'content control'),
-    (@bounceTypeID, 'delivery not authorized'),
-    (@bounceTypeID, 'does not conform to our e-?mail policy'),
-    (@bounceTypeID, 'excessive spam content'),
-    (@bounceTypeID, 'message looks suspicious'),
-    (@bounceTypeID, 'open relay'),
-    (@bounceTypeID, 'sender was rejected'),
-    (@bounceTypeID, 'spam(check| reduction software| filters?)'),
-    (@bounceTypeID, 'blocked by a user configured filter'),
-    (@bounceTypeID, '(detected|rejected) (as|due to) spam'),
-    (@bounceTypeID, 'X-HmXmrOriginalRecipient'),
-    (@bounceTypeID, 'Client host .[^ ]*. blocked'),
-    (@bounceTypeID, 'automatic(ally-generated)? messages are not accepted'),
-    (@bounceTypeID, 'denied by policy'),
-    (@bounceTypeID, 'has no corresponding reverse \\(PTR\\) address'),
-    (@bounceTypeID, 'has a policy that( [^ ]*)? prohibited the mail that you sent'),
-    (@bounceTypeID, 'is likely unsolicited mail'),
-    (@bounceTypeID, 'Local Policy Violation'),
-    (@bounceTypeID, 'ni bilo mogo..?e dostaviti zaradi varnostnega pravilnika'),
-    (@bounceTypeID, 'abuse report');
-
-INSERT INTO civicrm_mailing_bounce_type
-        (name, description, hold_threshold)
-        VALUES ('Syntax', '{ts escape="sql"}Error in SMTP transaction{/ts}', 3);
-
-SELECT @bounceTypeID := max(id) FROM civicrm_mailing_bounce_type WHERE name = 'Syntax';
-INSERT INTO civicrm_mailing_bounce_pattern
-        (bounce_type_id, pattern)
-        VALUES
-    (@bounceTypeID, 'nonstandard smtp line terminator'),
-    (@bounceTypeID, 'syntax error in from address'),
-    (@bounceTypeID, 'unknown smtp code');
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/AOL.sqldata.php")->toSQL();{/php}
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/Away.sqldata.php")->toSQL();{/php}
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/Dns.sqldata.php")->toSQL();{/php}
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/Host.sqldata.php")->toSQL();{/php}
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/Inactive.sqldata.php")->toSQL();{/php}
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/Invalid.sqldata.php")->toSQL();{/php}
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/Loop.sqldata.php")->toSQL();{/php}
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/Quota.sqldata.php")->toSQL();{/php}
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/Relay.sqldata.php")->toSQL();{/php}
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/Spam.sqldata.php")->toSQL();{/php}
+{php}echo (include "sql/civicrm_data/civicrm_mailing_bounce_type/Syntax.sqldata.php")->toSQL();{/php}
 
 {php}echo (include "sql/civicrm_data/civicrm_uf_group.sqldata.php")->toSQL();{/php}
 {php}echo (include "sql/civicrm_data/civicrm_uf_join.sqldata.php")->toSQL();{/php}