Want to Understand whether SMTP or API is best?

SMTP or API? What to Choose?

November 21, 2017

SMTP or API?

Uh oh, your friends have started arguing again, this time about SMTP and APIs and which is better. You have no idea so you keep quiet and watch them go on and on. In the heat of the conversation you are lost and on getting some alone time you decide to browse online and found this article right here (OK, maybe things didn’t happen like that, but you are here now). You have probably read lots of articles trying to explain the differences between SMTP and APIs and you are still confused. You just can’t seem to get what the fuss about SMTP and API is.

 

So what exactly is SMTP and what is API?

SMTP stands for Short Message Transfer Protocol. It is simply the set or laid down procedures or rules and principles to be used in sending emails/messages to an email server.

API in turn stands for Application Programming Interface and it is simply a means by which different applications, platforms, software and codes communicate with each other and share resources.

That seems pretty simple and straight forward right? That’s because it is. SMTP is basically the protocol that allows your computer or mobile email app to create and send emails to the server while an API is simply the window or communication to a another code or utility. For instance, you can use Pepipost to send emails from either SMTP (to be used directly from a mailing app or from Pepipost web mailing interface) or API (to be integrated as a code in your own platform allowing your platform to communicate with Pepipost and use it to send emails from another server entirely)

 

So now that you know what API and SMTP is, what are some pros of using SMTP?

  • Well, for starters, SMTP is the more widely adopted of the two, so you have little to no worry in the terms of integration and usage. Every device capable of sending email by extension uses SMTP. It is also easier to set up as well, all you need is to create an account which allows you to email using your email apps with any email service provider of your choice.
  • SMTP by extension requires little to no knowledge of coding or coding practices as your core focus is developing the emails and hitting the send button.
  • Using an SMTP, you get a direct message if anything goes wrong, with a special error message (either a 400 or 500 message that allows you know what is wrong)

 

OK, Now that we know the benefits of using SMTP, how about some of the major problems with SMTP?

  • SMTP requires numerous back and forth communication with the server. Using SMTP, the email has to have its DNS, authentication as well as other factors verified before it can be sent. Each one of these back and forth communication needs to be verified and either given a success message (a 250 message) or a failure message (400 or 500 message) and there are many opportunities for things to go wrong along the way.
  • Mail merge with SMTP can be a complicated process and might take a lot of time to create (Though this functionality is currently being tackled by a few third party apps like SalesHandy and Yesware)

 

Here’s an example of test content SMTP example

 

swaks -t to@example.com -f tepepipost.com --auth PLAIN --
auth-user your_smtp_username --
auth-password 'your_password' --tls --
server smtp.pepipost.com --h-
Subject "This is the test email from swak." "Test email from swak"

 
=== Trying smtp.pepipost.com:25...

=== Connected to smtp.pepipost.com.

<-  220 ESMTP SMTA 3 PEPIPOST Ready

-> EHLO NL454

<-  250-smta3.pepipost.com

<-  250-PIPELINING

<-  250-SIZE 20783082

<-  250-VRFY

<-  250-ETRN

<-  250-STARTTLS

<-  250-AUTH LOGIN PLAIN

<-  250-AUTH=LOGIN PLAIN

<-  250-ENHANCEDSTATUSCODES

<-  250-8BITMIME

<-  250 DSN

-> STARTTLS

<-  220 2.0.0 Ready to start TLS

=== TLS started with cipher TLSv1:DHE-RSA-AES256-SHA:256

=== TLS no local certificate set

=== TLS peer DN="/OU=Domain Control Validated/CN=*.pepipost.com"

~> EHLO NL454

<~  250-smta3.pepipost.com

<~  250-PIPELINING

<~  250-SIZE 20783082

<~  250-VRFY

<~  250-ETRN

<~  250-AUTH LOGIN PLAIN

<~  250-AUTH=LOGIN PLAIN

<~  250-ENHANCEDSTATUSCODES

<~  250-8BITMIME

<~  250 DSN

~> AUTH PLAIN AGltbW9uaWwAYWphQDM0NQ==

<~* 535 5.7.8 Error: authentication failed: authentication failure

*** No authentication type succeeded

~> QUIT

<~  221 2.0.0 Bye

=== Connection closed with remote host.

 

Not bad, with some advantages and a few disadvantages, how does SMTP compare to API? What are some of API’s advantages?

  • Well, API makes it easy to send emails and automate processes via your app and/or platform. Automating and executing mass mailing using API is a cinch (Please note however that this feature is also available if one is using a cloud SMTP instead of a local SMTP or a third party app like Mailpoet that can handle this)
  • APIs, in general, have better delivery speeds and can be executed in a matter of seconds. This isn’t to say that sending using SMTP is absolutely going to be a slow process, but API has less back and forth greenlighting required. This also reduces the potential steps for failure when sending an email.
  • API use can also provide you with some really important stats. This is of most use to people who do outreach and provide quality over email, as it lets you see how many people interacted with your email and in what way, helping you improve your approach to further improve your email communication. ( Again cloud-based and modern email service providers have changed this trend and offer metrics for both SMTP and API as well)
  • API also add an extra level of security with the use of an API key. This literally allows your platform, website or app alone to access your dashboard to execute email tasks. This extra level of security is especially important if you process and send very sensitive information via emails.
  • With the extra range of functionality included here, APIs can allow your platform act in different ways to different pre-set triggers. This allows for fluidity and flexibility in the operation of your website or platform.
  • Since APIs use HTTP, it is allowed by most firewalls, with the very exception of a few that have very specific restrictions.

 

Things look good for API, and yet there are a few disadvantages to point out.

  • Notably, among them is the fact that APIs (most of them) require a knowledge of codes to setup and execute. And it can be a real pain if this code is broken or the person has no idea of how to use it. It is even more problematic to understand the different metrics to be used while sending and how it affects the functionality of your website or platform.
  • API via API versioning changes as the years go by. They tend to require constant updates and modifications to keep up with the changes. SMTP by comparison does not have this issue, as it is a standard to be used for sending emails.

 

Sample API

 

curl -H "Content-Type: application/json" -X POST -d '{

"api_key": "your api key",

"email_details": {

"fromname": "Sender Name",

"subject": "test email subject",

"from": "from@example.com",

"content": "<p> Hi, this is a test email sent via Pepipost JSON API.</p>"

},

"recipients": [

"to@example.com"

]

}' http://api.pepipost.com/api/web.send.json

 

So, which is better – SMTP or API?

Many users as well as providers would give you many different answers. If you are a tech savvy individual, using API is a more appealing option as it offers enough avenue for you to customise and modify the setup to fit your needs. If you are a marketer, or an email influencer, using an API setup for email gives the added benefit of being able to execute automations, tracking as well as accessing metrics that will help you better understand how to make your messages speak more to the potential client.

However, if you are a more casual email sender and do not need access to metrics that lets you know how the emails perform, the SMTP set up is pretty good and handy, offering simplicity that can help you execute any basic task.

 

Conclusion

In general, the choice on whether to use SMTP or API is completely different and dependent on your needs as well as the capability of the platform you are using to send this emails. A cloud based SMTP service might be as effective as a HTTP API and yet an API could offer a bit more flexibility in the level of customizations as well as faster times and relatively low chance of failure due to verification processes.

So what do you think? Do you know of any extra reasons why one edges out the other? Do you think there is something I might have missed in my discussion? Please let me know in the comments section below.

 

 

Write a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

img

Dibya Prakash Sahoo|The Business Guy