Mailgun is the email automation engine trusted by over millions of websites and application developers for sending, receiving and tracking emails.
Constant Contact is an email marketing application that lets you create effective email marketing and other online marketing campaigns to meet your business goals.
Constant Contact IntegrationsMailgun + Constant Contact
Create Contact to Constant Contact from New Unsubscriber in Mailgun Read More...Mailgun + Constant Contact
Update Contact in Constant Contact when New Unsubscriber is created in Mailgun Read More...Mailgun + Constant Contact
Create Contact to Constant Contact from New Subscriber in Mailgun Read More...Mailgun + Constant Contact
Update Contact in Constant Contact when New Subscriber is created in Mailgun Read More...It's easy to connect Mailgun + Constant Contact without coding knowledge. Start creating your own business flow.
Triggers whenever a new subscriber is added.
Triggers when a current subscriber unsubscribed.
Triggers when a new contact is created.
Triggers when a recipient open an email for specified campaign.
Triggers when a new list is created.
Creates a contact
Creates a new contact and updates an existing contact.
Delete a contact.
Updates a contact.
(30 seconds)
(10 seconds)
(30 seconds)
(10 seconds)
(2 minutes)
My name is Ryan and I am a developer. I work in an office building in Seattle, WA. One day, my manager came to me and said that I have to do an article on Mailgun and Constant Contact. He didn’t tell me why he wanted me to do it, but I was happy to help out.
Mailgun is a service that simplifies the sending of email. It is used by many companies who want to send email to their customers or potential customers. On the Mailgun website you can see their logo. It says “Send Better Email”. That statement sums up what Mailgun does. They make sending email easier.
Constant Contact is another email sending service. It has been around since 1997, which makes it one of the pdest email sending services. It also has some of the most positive reviews on the internet. I use it all the time, but I didn’t know that Constant Contact had a partnership with Mailgun until my manager tpd me about it. Now I use both services to send email. Sometimes I use Mailgun, sometimes I use Constant Contact, but mostly I use both.
I mentioned above that I used Mailgun and Constant Contact together. So let me show you how they are integrated. First, let me give you some background on each of them. Mailgun is basically just an email sending middleware. It takes care of all the heavy lifting, so you don’t have to worry about it. Constant Contact is more than just an email sending service. It is more like an email marketing suite. It provides many features for email marketing, such as newsletters, event registration, contacts, etc. As far as integration goes, there are two ways you can use Mailgun and Constant Contact together—as a middleware or through the Constant Contact interface. Using them both together works very well, because most developers want to send email through their own application. This means that all the heavy lifting has already been done by Mailgun, so they can easily integrate it into their application with minimal changes.
First, let’s talk about how these two services integrate through Constant Contact. You need to create an account with Mailgun, then go to your Constant Contact dashboard and navigate to your settings. From here, you can link your Mailgun account with your Constant Contact account. This will allow you to send emails like this:
mailgun . send ( '[email protected]' , 'Subject' , 'Body' )
You can see here that we are using a Python library called mailgun-python to send our email through Mailgun. The first argument is the recipient’s email address, the second argument is their subject line, and the third argument is their body content. This method of integration is very simple and straightforward, but it does have some limitations. In this case, if you want to change any data about your recipient or your message, you have to change your existing code from your application. This may not be a problem for some projects, but if you have a lot of recipients or messages you may want a more dynamic spution.
Now let’s talk about how these two services integrate through middleware. The first step is to create a middleware object in your app’s routes file:
import os import requests from mailgun_middleware import MailgunMiddleware from mailgun_middleware import enable_logging from constant_contact_middleware import ConstantContactMiddleware enable_logging (. # Enable logging from mailgun_middleware import authenticate app = Flask ( __name__ . app . config [ 'MAILGUN_SECRET_KEY' ] = os . environ . get ( 'MAILGUN_SECRET_KEY' . app . config [ 'CONSTANT_CONTACT_API_KEY' ] = os . environ . get ( 'CONSTANT_CONTACT_API_KEY' . mailgun_middleware = MailgunMiddleware ( app , os . environ . get ( 'MAILGUN_DOMAIN' ). constant_contact_middleware = ConstantContactMiddleware ( app , os . environ . get ( 'CONSTANT_CONTACT_API_KEY' ). # Register the middlewares. app . register_blueprint ( 'localhost:8888' , 'live' , url_prefix = '/live' , middleware = [ mailgun_middleware , constant_contact_middleware ])
With this example we are creating a new Flask app and importing three different objects. mailgun_middleware , constant_contact_middleware , and constant_contact_api_key . We then pass those objects into the constant contact middleware and mailgun middleware objects that we created above. These objects will now be available for use in our app by simply adding them as arguments in our routes file like this:
@app . route ( '/send-email/<string:token>' . def send_email ( token ). try . response = requests . get ( "https://api.mailgun.net/v3/ < string . MAILGUN_DOMAIN > /messages" , params = { "From" . "<string:from>" , "To" . "<string:to>" , "Subject" . "<string:subject>" , "Content" . "<string:body>" }. response . raise_for_status (. if response . ok . # If it worked... print ( response . json ()[ 'MessageId' ]. mailgun_message = mailgun_middleware . message ( token . if not mailgun_message . raise RuntimeError ( "Couldn't get message" . else . print ( "Successfully got message!" . except Exception as e . # If it failed... print ( e . return render_template ( 'send-email-failed.html' , token = token . @app . route ( '/send-email-failed/<string:token>' . def send_email_failed ( token ). return render_template ( 'send-email-failed.html' )
The process to integrate Mailgun and Constant Contact may seem complicated and intimidating. This is why Appy Pie Connect has come up with a simple, affordable, and quick spution to help you automate your workflows. Click on the button below to begin.