Overview
Performing regular data validation is a critical step of list hygiene and we have identified some recommended data validation vendors that perform this service.
However, if you do not have access to a 3rd party vendor, you can use the method outlined in this article to isolate and suppress any email addresses that contain common typos such as gmial.com or yaho.com.
After all steps below have been completed, upon message send the provided code will:
- Identify any email addresses with common typos.
- Stop the message from sending to the problematic email address.
- Provide the message ID that triggered the suppression and the problematic email address.
- Add the problematic email address to a list.
- Change the subscribe status of the problematic address to unsubscribed.
Create two contact attributes
Create the following two string attributes in your account:
- suppress_msid - Used to identify the message ID.
- suppress_status - Used to identify the problematic address.
Create a list
Create the following list within your account and enable date tracking:
- suppression_list - All problematic email addresses will be added to this list when a message sends.
Create an HTML content include
Create an HTML content include called suppress_domain and paste in the following code:
{* The goal of this code is to suppress (unsubscribe) bad email domains. This code can make an email send slow and to limit this, we do not want it running all the time. So we write down suppress_status and suppress_msid at the contact level. This code will first do an exact match. This means it will look at the contacts domain and see if that domain is in the list suppress_domains_exact. Then it will do an ends with match. This means it will check each part of the domain in reverse order and see if the contact should be suppressed. For example if you want to block all .com.com you can add .com.com to the suppress_domains_ends_with list and user@gmail.com.com will be blocked and so will user@yahoo.com.com For this code to work, the account MUST have a contact attribute called suppress_status and suppress_msid and both must be of type string And you must have a list called suppression_list *} {$domain_suppression.suppress_domains_exact = json_decode('{"gmial.com":1, "yahooo.com":1, "gmai.com":1, "gmal.com":1, "gnail.com":1, "test.com":1, "gmail.co":1, "example.com":1, "yaho.com":1, "gmil.com":1, "yhoo.com":1, "yahoo.co":1, "hitmal.com":1, "yhaoo.com":1, "hotmai.com":1, "gmaill.com":1, "yaboo.com":1, "yaoo.com":1, "gamail.com":1, "hotmal.com":1, "gmaol.com":1, "hotnail.com":1, "cloud.com":1, "cmcast.net":1, "a.com":1, "hotmaill.com":1, "sbcglobal.com":1, "hormail.com":1, "hotnail.com":1, "ol.com":1, "yahool.com":1, "yahoi.com":1, "hoymail.com":1, "sbcglobel.net":1, "1234.com":1, "verizion.net":1, "kiois.net":1, "bugmenot.com":1, "facebook.com":1, "tahoo.com":1, "hotmsil.com":1}', 1)}
{$domain_suppression.suppress_domains_ends_with = ['.com.com', '.con', '.cm', '.comm', '.vom', '.c']} {$domain_suppression.debug = 0} {$domain_suppression.contact_email_parts = "@"|explode:$contact.channels.email.address} {$domain_suppression.contact_domain = $domain_suppression.contact_email_parts[1]} {if $domain_suppression.suppress_domains_exact[$domain_suppression.contact_domain]} {$domain_suppression.suppress_status = $domain_suppression.contact_domain} {$domain_suppression.stopMessage = 1} {/if} {if $domain_suppression.stopMessage != 1} {foreach $domain_suppression.suppress_domains_ends_with as $domain} {$domain_suppression.check_domain = $domain} {$domain_suppression.check_domain_len = $domain_suppression.check_domain|count_characters} {$domain_suppression.contact_domain_ends_with = $domain_suppression.contact_domain|substr:-$domain_suppression.check_domain_len} {$domain_suppression.suppress_count = -1} {for $i = ($domain_suppression.check_domain_len - 1) to 0 step -1} {if $domain_suppression.contact_domain_ends_with[$i] == $domain_suppression.check_domain[$i]} {$domain_suppression.suppress_count = $domain_suppression.suppress_count + 1} {else} {break} {/if} {/for} {if $domain_suppression.suppress_count == ($domain_suppression.check_domain_len - 1)} {$domain_suppression.suppress_status = $domain_suppression.check_domain} {$domain_suppression.stopMessage = 1} {break} {/if} {/foreach} {/if} {if $domain_suppression.stopMessage == 1} {$utils->updateContact(['suppression_list'=>true, 'suppress_msid'=>$message.msID,'suppress_status'=>$domain_suppression.suppress_status,"channels.email.subscribeStatus" => "unsubscribed"])} {/if} {if $domain_suppression.debug == 1} <h1>Contact Data</h1> <pre> {$JSON_PRETTY_PRINT = 128} {json_encode($contact, $JSON_PRETTY_PRINT)} </pre> <br><hr><br> <h1>Domain Suppression Data</h1> <pre> {$JSON_PRETTY_PRINT = 128} {json_encode($domain_suppression, $JSON_PRETTY_PRINT)} </pre> <br><hr><br> {/if}
While we have identified the most common email address typos and added them to the above HTML content include, you may discover other problematic email address specific to your business use case. If so, you may add them to the code above and begin suppressing them from your message sends.
Reference the HTML include in a message
Reference the HTML content include by pasting the following code at the top of your message content:
{include 'content:suppress_domain' scope='parent' assign='blackhole'}{if $domain_suppression.stopMessage == 1}{stopMessage}{/if}
Send the message containing the HTML content include
Once you've performed the steps outlined above, you can send the message. The code automatically add contacts with problematic email addresses to the suppression list and changes the their subscribe status to unsubscribed.
View the suppressed contacts
After an email containing the above HTML content include code has been sent, you can search for contacts that belong to the list called suppression_list and view the individual contacts. Any contact that was suppressed now has their subscription status set to unsubscribed.
View the suppression reason
Any suppressed contacts will have the problematic email address listed in the attribute called suppress_status and the message ID that triggered the suppression in the attribute called suppress_id.
Comments
0 comments
Please sign in to leave a comment.