Here are some example rules to help you get started.
Add an Automatic Unsubscribe Footer
Mandrill provides a Sending Default option to add an automatic unsubscribe footer. You may not want to append an unsubscribe footer to every email, though. You can use Rules to enable or disable the unsubscribe footer for some emails. For example, add the unsubscribe footer only to your emails tagged "marketing":
Add a Tag for Emails Sent with SMTP
If you're unable to add Mandrill's custom SMTP headers to influence sending behavior and customize your emails, use a rule instead. Here's an example of rule that adds the tag password-reset to all emails from the sender firstname.lastname@example.org:
Apply a Template With Editable Content Blocks
Templates allow you to create your email design and store commonly used content to re-use for different transactional emails. You can store templates in Mandrill and then send email using the template and providing dynamic, recipient-specific content.
The following rule applies the template verify-email to any messages that have the word verification anywhere in the subject line and places the message content into the editable template block called main.
Now, when you send a message with a subject line like "Your verification email from domain.com", this rule will be applied.
Reject Emails With an Empty Subject Line
Rule conditions also support null values. To create a new rule that will reject any emails that don't have any content in the subject line, set up your rule like the one in this example, but don't type any text or click into the last text field after the matches drop-down menu:
Blacklist a Domain
Mandrill allows you to add email addresses to your Rejection Blacklist manually, but adding an entire domain isn't supported. You can set up a rule to reject any emails from a particular domain. For example, you may be sending test emails to a domain that doesn't exist or attempting to block unwanted senders from relaying email through your Mandrill account.
Run a Test on a Random Sample of Emails
Sometimes you want to make a change to your email, but you're not sure if the change will be effective. Will recipients open and click more, or will they click less? Maybe you want to do an A/B split test on your change, or maybe you want to limit the change to some small percentage of your emails as a trial.
Sse random sample as part of your rule conditions, along with to the other criteria for the rule. Then, take actions like changing a template or modifying Google Analytics tracking, and those changes will only apply to that random subset.
After the test is generating data, use stats comparison reports to chart and compare the differences between the groups. When you're ready to pick a winner, just change the winning rule to match all the time and delete the others.
Create API key, Sender, or Domain-Specific Webhooks
This is useful if you only want events tied to a certain domain, sender email address, or API key to post to a webhook URL. For example, you might want to have all email events from your test environment only POST to a specific test endpoint on your server. In this case, first you'd create a new webhook that POSTs to your test endpoint. When creating the webhook, don't select any events. For example:
Then, create a rule that looks for any emails sent from the API key being used for your testing environment and choose your test webhook URL:
You'll need to create a new rule for each event that you'd like to receive information about (sent, bounced, opened, etc.).
Follow the same steps to create a domain-specific webhook. This time, your rule conditions might look like: