Mailchimp Transactional
Official Python client for Mailchimp Transactional Email API (formerly Mandrill). Current version is 1.3.3 (Feb 2026). Install name is mailchimp-transactional (hyphen), import name is mailchimp_transactional (underscore). Requires a paid Mailchimp Standard plan or higher — not available on free accounts.
Warnings
- breaking Install name and import name differ. pip install mailchimp-transactional (hyphen), then import mailchimp_transactional (underscore). LLMs frequently generate import mailchimp-transactional which is a SyntaxError.
- breaking Requires paid Mailchimp Standard plan or higher. The Transactional API (formerly Mandrill) is NOT available on free Mailchimp accounts. Attempting to use a free account API key returns: 'This account does not have access to the Transactional API.'
- breaking Mandrill/Transactional API key is SEPARATE from the Mailchimp Marketing API key. Using the wrong key returns 401 Invalid API Key errors. Transactional keys are generated at mandrillapp.com settings.
- gotcha All API requests are HTTP POST, not RESTful GET/PUT/DELETE. The entire API surface (including read operations like messages.search) uses POST. The Python client handles this transparently but raw HTTP implementations must use POST.
- gotcha The API base URL is still mandrillapp.com (not mailchimp.com), a legacy artifact of the Mandrill → Mailchimp Transactional rebrand. Documentation still references both names interchangeably.
- gotcha Sending from an unverified domain silently soft-fails or degrades deliverability. DKIM and DMARC must be configured for the sending domain before production use.
Install
-
pip install mailchimp-transactional
Imports
- mailchimp_transactional
import mailchimp_transactional as MailchimpTransactional from mailchimp_transactional.api_client import ApiClientError try: client = MailchimpTransactional.Client('YOUR_MANDRILL_API_KEY') response = client.users.ping() print('API called successfully: {}'.format(response)) except ApiClientError as error: print('An exception occurred: {}'.format(error.text)) - messages.send
response = client.messages.send({ 'message': { 'from_email': 'hello@yourdomain.com', 'subject': 'Hello', 'text': 'Welcome!', 'to': [{ 'email': 'recipient@example.com', 'type': 'to' }] } })
Quickstart
import mailchimp_transactional as MailchimpTransactional
from mailchimp_transactional.api_client import ApiClientError
client = MailchimpTransactional.Client('YOUR_MANDRILL_API_KEY')
# Verify API key works
try:
response = client.users.ping()
print('Ping:', response) # 'PONG!'
except ApiClientError as e:
print('Error:', e.text)
# Send a transactional email
try:
response = client.messages.send({
'message': {
'from_email': 'noreply@yourdomain.com',
'from_name': 'Your App',
'subject': 'Password Reset',
'html': '<p>Click <a href="{reset_url}">here</a> to reset your password.</p>',
'to': [{'email': 'user@example.com', 'type': 'to'}],
'track_opens': True,
'track_clicks': True
}
})
print('Sent:', response)
except ApiClientError as e:
print('Send failed:', e.text)