Mailgun + Formatter By Connect Integrations

Appy Pie Connect allows you to automate multiple workflows between Mailgun and Formatter By Connect

About Mailgun

Mailgun is the email automation engine trusted by over millions of websites and application developers for sending, receiving and tracking emails.

About Formatter By Connect

Formatter by Connect is our own formatting tool that is designed to format data in a way that ‘s easy to understand for procedding your “connects”.

Formatter By Connect Integrations
Connect Mailgun + Formatter By Connect in easier way

It's easy to connect Mailgun + Formatter By Connect without coding knowledge. Start creating your own business flow.

  • New Subscriber

    Triggers whenever a new subscriber is added.

  • New Unsubscriber

    Triggers when a current subscriber unsubscribed.

  • Date / Time

    Work with dates and times to change formatting or add/subtract time (with line-item support).

  • Numbers

    Work with numeric data to do math operations, reformat currencies, and more (with line-item support).

  • Text

    Work with text data to find & replace, capitalize, remove HTML, and more (with line-item support).

  • Utilities

    Various utilities like "choose value from list" or "look up in table" (with line-item support).

How Mailgun & Formatter By Connect Integrations Work

  1. Step 1: Choose Mailgun as a trigger app and Select "Trigger" from the Triggers List.

    (30 seconds)

  2. Step 2: Authenticate Mailgun with Appy Pie Connect.

    (10 seconds)

  3. Step 3: Select Formatter By Connect as an action app.

    (30 seconds)

  4. Step 4: Pick desired action for the selected trigger.

    (10 seconds)

  5. Step 5: Authenticate Formatter By Connect with Appy Pie Connect.

    (2 minutes)

  6. Your Connect is ready! It's time to start enjoying the benefits of workflow automation.

Integration of Mailgun and Formatter By Connect

Mailgun is a simple, easy to use email infrastructure that can be integrated with various applications. It is an email service provider which provides developers and businesses with powerful tops for sending and receiving emails. Mailgun is capable of handling massive amount of traffic and support all popular protocps. As a developer, it is important for you to know how to integrate Mailgun with other services as well as how to make the most of its features. Integration should be done properly in order to avoid any problem that might cause security breach or data loss. This article will help you with that, so read on!

Formatter By Connect is an email parser that converts text into rich objects. It is used for parsing email messages and extracting data from them. Formatter By Connect parses MIME encoded emails. It provides you with different ways of extracting data, so you have more contrp over the process. You can even extract plain text emails.

Integration between Mailgun and Formatter By Connect is very easy. For this purpose, you need to create a class that implements MailgunMailerInterface interface. Then you need to add a reference to the library and instantiate it. Here is an example:

class Mailer

include MailgunMailerInterface


class OutgoingEmail < ApplicationRecord

belongs_to :mailer, :class_name => "Mailer"

has_attached_file :attachment

has_many :incoming_emails, dependent. :destroy


IncomingEmail < ApplicationRecord

# ...

def send_email(message)

message.subject = message.subject.gsub(/s{2,}/, ".capitalize

message.body = FormatterByConnect::TextExtractor.new(message.extract unless message.attachments.empty?

message.from = message.sender

message.to = message.recipients.map { |a| [a["email"], a["name"]]}.join(" ")




def attachments_for(dual_key. # ... end


In the above example, we have created a class called Mailer which implements MailgunMailerInterface interface and has a belongs_to relationship to OutgoingEmail model which will hpd the email details and has an attached file (if any. We also created IncomingEmail model which will hpd the information about the incoming email such as To, From, Subject, date, etc., along with its attachments. Now look at the send_email method; here we are creating the new instance of Formatter by Connect's TextExtractor class and extracting the body of the email using the extract method of the instance we have created previously. After extracting the body of the email, we are removing any line feed characters from the body using gsub method and capitalizing its first letter using gsub method again then saving the outgoing message in OutgoingEmail model. Finally, we are calling Mailer's send method to send the email out using Mailgun's API endpoint. The attachments_for method takes dual key as input and returns all attachments related to that particular email if there are any attachments present in it. If there are no attachments, then instead of returning an array containing one element, it will return an empty array. So you have full contrp over what you do with your data. You can even store your attachment in external storage or use some third-party service for storing them like Amazon S3 or Dropbox etc., if you want to keep your database lightweight without increasing any unnecessary load on it. Finally look at Mailgun's official documentation for further information about the library [1]. There you can find some examples as well which may help you in getting started quickly! So let's take a look at some benefits of integration of Mailgun and Formatter by Connect:

Benefits of Integration of Mailgun and Formatter by Connect:

1- Security

As you can see in our example above, whenever we are going to send out an email using Mailgun API endpoint we are setting up our own sender address instead of using Mailgun's default sender address by calling message.from = message.sender . This way we can easily identify any SPAM or junk mail using our SMTP server and prevent them from reaching our customers' inboxes. Whereas, if we were not doing this but using Mailgun's default sender address then SPAM/junk mails would easily pass through our SMTP server and reach our customer's inboxes causing lots of trouble for us as well as for our customers who receive lots of SPAM/junk mails every day which they don't want to get at all. One more thing that we should remember is that we should not always use real email addresses as sender address because if anyone gets their hands on those then they could use them for spamming too and that would lead to serious problems for us! Also in our example we are doing an extra step by removing line feed characters from the body so it would appear better when users receive it in their inboxes. In this way users will be able to understand your message easily without having to open multiple windows for opening your website/page etc., and reading it! It will save their time too! Another security measure that we have taken in our example is that when we are sending out emails using Mailgun API endpoint we are not running them through our application SMTP server but directly calling Mailgun's API endpoint hence preventing any possible security breach from happening due to malicious code in our application SMTP server!

2- Time Saving!

As you can see in our example above, sending out an email was really quick by making use of Mailgun's API endpoint rather than running it through our application SMTP server! So basically integration of Mailgun and Formatter by Connect will save your application a lot of time while sending emails! It saves even more time when you have lots of data to be sent out!

3- Easy maintenance!

We need not worry about maintaining our SMTP server or anything else after integrating Mailgun with our application because everything will be handled by Mailgun itself and will be taken care of by them too! This allows us to focus on other important tasks rather than worrying about how to send out emails because now we have a reliable email service provider who can take care of all these things for us! Finally integration of Mailgun with Formatter by Connect allows us to focus on other important tasks without having to worry about sending out emails because now it is all taken care of by Mailgun itself! All we need to do is just write our code and run it! It adds a level of abstraction automatically so our application does not have to handle emails at all! Think about it, wouldn't it be great?! That means less load on your database as well because now there are less activities occurring on it!

4- Data loss prevention

Integration with Mailgun allows us to prevent data loss due to accidental deletion or accidental removal of emails from the database because once they have been sent they cannot be retrieved back again! Furthermore if we need any particular email for future use then we can easily fetch it from the database without having to worry about losing it because now we have a place where all of our emails are stored safely! That means no more duplicates and no more confusion over which email goes where! Also if any email needs to be deleted then deleting it using Mailgun's API endpoint also makes sure that it cannot be recovered back again unless someone has already saved it somewhere else using their SMTP server or has saved its attachment somewhere else! That means no more data loss due to accidental deletion or removal from the database! Therefore integration of Mailgun with Formatter by Connect allows us to prevent accidents like accidental deletion or accidental removal from the database because once they have been sent they cannot be retrieved back again! This also prevents any issue due to duplicate data entry since every email will have its own unique ID assigned by Mailgun which will be used for identifying each email uniquely hence preventing any issue due to duplicate entries!

5- Minimized cost

Since we don't need to maintain any separate server for sending out emails anymore then there is no cost associated with maintaining such servers, therefore saving us money and minimizing cost hence increasing ROI (Return On Investment)! Also integration with Mailgun helps us save money because now we don't need to pay for hosting both SMTP servers as well as web servers separately but instead we will only need one account on Mailgun where both web server as well as SMTP

The process to integrate Mailgun and Formatter By Connect 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.