Being able to leverage content from your website is not only a great time saver, it's also a way to give prominence to all of the great information found there. With your website being one of your largest content assets, Snag Mail helps you get the most out of it as possible.
Snag Mail enables you to harvest website content and place it in a message as a story. This is a great feature to have in your email marketing bag of tricks.
Creating a Snag Mail
Navigate to Mailings > Create > Snag Mail.
On the resulting page, you'll need to identify the portion of a web page to use as a story in a message. To do so, begin by giving your Snag Mail a name and subject.
Then:
1 - Select the web page to snag from
In the URL to snag field, enter the fully formed URL to get to the web page to snag from (HTTP or HTTPS must be included).
2 - Identify where on the web page the content should come from
Snagging works by having upper and lower markers (HTML tags) to use as the boundaries for the content to be snagged. These markers are excluded from the snagged content. Add these markers in the Start/End crop at fields.
Assuming that you'll be snagging from the same page multiple times, it's a worthwhile investment to work with your web designer to place specific tags on the page specifically for this use. This could be something like <InformzSnag> and </InformzSnag>. This way it's easy and 100% clear where the content is coming from. If you don't have the wherewithal to add Informz-specific tags to your page, then you have to look for consistent HTML tags that denote the beginning and end of the section of content that you want to pull into a mailing.
3 - Determine the text to precede or follow the web page content
If having static text before and after the snagged content is desirable, you can put that in the Prepend and Append fields. As shown in the image above, providing some guidance to find additional content can be a good approach for these fields.
4 - Make substitutions to ensure that the web page content works within a mailing
There may be times when references made on a web page will not work well when the content is decoupled from the website. For these situations, you can use the search and replace options - there are nine - to make these swaps. The most common is to provide an externally accessible URL for images. The example below depicts that example:
This could take a bit of trial and error, so be sure to use the Test Snagging button to verify your settings. You can also use regular expressions to assist you here.
5 - Manage the text version (optional)
The text version of a snag mail will be generated automatically if you leave the field blank. You likely only need to spend time here if you want your text version to be different in some way.
6 - Select a target group
Use the Folder and Target menus to select your Target Group. You can click the View Details button to see more detail about your selection, including the message's targeted recipients.
7 - Select a template
All mailings sent from your account require a template. Select any standard template to use with your snag mail.
Snag Mail Regular Expressions
A snag mail grabs a portion of a web page and turns it into a single-story mailing. One feature of snag mail is the ability to use regular expressions to further query and limit what's "snagged" from the web page.
Regular expressions are almost another language, but users familiar with Perl will feel right at home. Here are some of the pattern sets used to define regular expressions. These sets can be broken down into several categories and areas:
Position matching
Position matching involves the use of the ^ and $ to search for beginning or ending of strings. Setting the pattern property to "^Informz" will only successfully match "Informz is cool." However, it will fail to match "I like Informz."
Symbol | Function |
---|---|
^ | Only match the beginning of a string. "^A" matches first "A" in "An A+ for Anita." |
$ | Only match the ending of a string. "t$" matches the last "t" in "A cat in the hat" |
\b | Matches any word boundary. "ly\b" matches "ly" in "possibly tomorrow." |
\B | Matches any non-word boundary. |
Literals
Literals represent alphanumeric characters. Since some characters have special meanings, they must be “escaped.” To match these special characters, precede them with a "\" in a regular expression.
Symbol | Function |
---|---|
Alphanumeric | Matches alphabetical and numerical characters literally. |
\n | Matches a new line |
\f | Matches a form feed |
\r | Matches carriage return |
\t | Matches horizontal tab |
\v | Matches vertical tab |
\? | Matches ? |
\* | Matches * |
\+ | Matches + |
\. | Matches . |
\| | Matches | |
\{ | Matches { |
\} | Matches } |
\\ | Matches \ |
\[ | Matches [ |
\] | Matches ] |
\( | Matches ( |
\) | Matches ) |
\xxx | Matches the ASCII character expressed by the octal number xxx. "\50" matches "(" or chr (40). |
\xdd | Matches the ASCII character expressed by the hex number dd. "\x28" matches "(" or chr (40). |
\uxxxx | Matches the ASCII character expressed by the UNICODE xxxx. "\u00A3" matches "£". |
Character classes
Character classes enable customized grouping by putting expressions within [] braces. A negated character class may be created by placing ^ as the first character inside the []. In addition, a dash can be used to relate a scope of characters. For example, the regular expression "[^a-zA-Z0-9]" matches everything except alphanumeric characters. In addition, some common character sets are bundled as an escape plus a letter.
Symbol | Function |
---|---|
[xyz] | Match any one character enclosed in the character set. "[a-e]" matches "b" in "basketball". |
[^xyz] | Match any one character not enclosed in the character set. "[^a-e]" matches "s" in "basketball". |
. | Match any character except \n. |
\w | Match any word character. Equivalent to [a—zA—Z_0—9]. |
\W | Match any non-word character. Equivalent to [^a—zA—Z_0—9]. |
\d | Match any digit. Equivalent to [0—9]. |
\D | Match any non-digit. Equivalent to [^0—9]. |
\s | Match any space character. Equivalent to [ \t\r\n\v\f]. |
\S | Match any non-space character. Equivalent to [^ \t\r\n\v\f]. |
Repetition
Repetition allows multiple searches on the clause within the regular expression. By using repetition matching, the number of times an element may be repeated in a regular expression, can be specified.
Symbol | Function |
---|---|
{x} | Match exactly x occurrences of a regular expression. "\d{5}" matches 5 digits. |
(x,} | Match x or more occurrences of a regular expression. "\s{2,}" matches at least 2 space characters. |
{x,y} | Matches x to y number of occurrences of a regular expression. "\d{2,3}" matches at least 2 but no more than 3 digits. |
? | Match zero or one occurrences. Equivalent to {0,1}. "a\s?b" matches "ab" or "a b." |
* | Match zero or more occurrences. Equivalent to {0,}. |
+ | Match one or more occurrences. Equivalent to {1,}. |
Alternation and Grouping
Alternation and grouping are used to develop more complex regular expressions. Using alternation and grouping techniques can create intricate clauses within a regular expression, and offer more flexibility and control.
Symbol | Function |
---|---|
() | Grouping a clause to create a clause. May be nested. "(ab)?(c)" matches "abc" or "c." |
| | Alternation combines clauses into one regular expression and then matches any of the individual clauses. "(ab)|(cd)|(ef)" matches "ab" or "cd" or "ef". |
Backreferences
Backreferences enable the programmer to refer back to a portion of the regular expression. This is done by use of parenthesis and the backslash (\) character followed by a single digit. The first parenthesis clause is referred by \1, the second by \2, etc.
Symbol | Function |
---|---|
()\n | Matches a clause as numbered by the left parenthesis. "(\w+)\s+\1" matches any word that occurs twice in a row, such as "hubba hubba." |
Examples
- "^\s*((\$\s?)|(£\s?))?((\d+(\.(\d\d)?)?)|(\.\d\d))\s*(UK|GBP|GB|USA|US|USD)?)\s*$"
- "^\s*…" and "…\s*$" - means that there can be any number of leading and end space characters, and the input must be on a line by itself
- "((\$\s?)|(£\s?))?" - means an optional $ or £ sign followed by an optional space
- "((\d+(\.(\d\d)?)?)|(\.\d\d))" - searches for at least one digit, followed by an optional decimal and two digits (which are optional) or a decimal and two digits. This means that input such as 6., 23.33, .88 are all allowed, but 5.5 is not.
- "\s*(UK|GBP|GB|USA|US|USD)?" - means that any number of space characters are valid followed by optional and acceptable arguments to the string.
In this example, regular expressions are used to determine if the user entered US dollars or British pounds. Search for the strings £, UK, GBP, or GB. If the regular expression is true, then the user has entered an amount in British pounds. Otherwise, assume USD currency.