Cloud Platform as a Service

Cloud Platform as a Service

Join us to learn more from a community of collaborative experts and IBM Cloud product users to share advice and best practices with peers and stay up to date regarding product enhancements, regional user group meetings, webinars, how-to blogs, and other helpful materials.

 View Only

API vs. SMTP: Understanding Email Integration with IBM Cloud Event Notifications

By Deepthi Ramesh Chandra posted 30 days ago

  

ℹ️ This blog is part of a continuing series related to IBM Cloud Event Notifications.  Event Notifications is an enterprise notification routing service that also provides a full-feature outbound transactional email platform.  For more information see IBM Cloud Email Service with Custom Domain and Using the Event Notifications SMTP Interface.

Email remains one of the most widely used ways for applications to communicate with users, administrators, and other systems. Whether it is a password reset, an order confirmation, an infrastructure alert, or a billing notification, applications need a reliable way to deliver these messages.

IBM Cloud Event Notifications accepts email from applications in two ways: through its API (Application Programming Interface) and through SMTP (Simple Mail Transfer Protocol). Both end the same way, with an email in a recipient’s inbox, so the choice is really about how your application hands the message to the service and what that handoff makes possible. This blog explains the difference, what it means in practice, and how to decide.

What is the technical difference?

An API is a programmatic interface between an application and a service. With an API integration, the application sends an HTTPS request to Event Notifications containing structured data about something that happened. For example, an e-commerce application might send:

Event: Order completed | Customer: Jane | Order: 45821 | Status: Shipped

The application encapsulates this transaction data within a JSON schema that includes other attributes like a long and short description of the associated message.   (Learn more here.) Notice this is not a pre-formed email with subject line, a body, or mail headers. The application is describing an event, not writing an email. That is what it means to say the API operates at the application layer.

SMTP operates at the email transport layer. It is the standard protocol that mail clients and mail servers have used to exchange email for decades. An SMTP-enabled application constructs a complete email message, including sender, recipient, subject, headers, and body, and submits it to an SMTP server. Here the application is writing an email, and Event Notifications is the mail server it submits to.

The fundamental distinction: the API sends structured application data to a service; SMTP sends a finished email message to a mail server.

If both end as email, where does the API data become an email?

This is the question the distinction naturally raises. Email travels between organizations over SMTP; there is no other way to deliver a message into a recipient’s mailbox. So an API integration does not avoid SMTP. It moves the work of producing the SMTP message from your application to Event Notifications. The two paths look like this:

API:   Application → event data over HTTPS → Event Notifications builds the email → SMTP → recipient’s mail server

SMTP: Application builds the email → SMTP → Event Notifications → SMTP → recipient’s mail server

If you have heard the term SMTP relay, this is where it applies. A relay is a mail server that accepts an already-built email and forwards it toward its destination. On the SMTP path, Event Notifications is an authenticated SMTP relay: SMTP in, SMTP out. On the API path it is not relaying anything, because no email arrived; it originates the message from your event data and then delivers it.

Either way, Event Notifications handles the last leg: it applies your domain’s authentication, hands the message to the recipient’s mail server, and records what happened. What differs is who builds the email, and therefore what Event Notifications knows about the message before it is sent.

Why let Event Notifications build the email?

Because when the service receives data instead of a finished message, it can do something with that data. The main benefit is templates.

Templates let the content and presentation of an email be managed separately from application logic. The application sends event data, and the template turns it into the message:

Customer = Jane | Order = 45821 | Status = Shipped

Hello Jane, your order 45821 has been shipped.

Event Notifications supports dynamic variables and conditional logic in email templates, so one template can produce different content depending on the event data. This matters most when notification content changes independently of application functionality: an organization can update the wording, branding, or layout of a notification without touching the application code that generates the underlying event.

With SMTP, the email already exists when it arrives. Event Notifications receives a rendered message, so the sending application owns the content and presentation. Templating is still possible, but it lives in the sending application, and changing how the email looks means changing that application.

In short: both approaches deliver email, but the API gives Event Notifications a role in composing it, while SMTP keeps that role with the application.

Then why would anyone use SMTP?

Because many systems already speak it, and nothing else. Enterprise applications, monitoring platforms, infrastructure tools, network appliances, and legacy systems commonly have SMTP configuration built in: a server address, a port, and credentials. Pointing that configuration at Event Notifications is a configuration change, not a development project. The application keeps generating email exactly as it does today, and Event Notifications replaces whatever mail server it used before.

Event Notifications supports secure SMTP connections through port 587 with STARTTLS and port 465 with implicit TLS/SSL.

Does the choice affect what you can see after sending?

Sending an email is only the first step; it is just as important to know what happened afterward. Because Event Notifications performs the final delivery in both models, it can report on delivery in both models:

•       Sent – the number of emails submitted for delivery

•       Delivered – the number of emails successfully delivered

•       Failed – the number of emails that could not be delivered

•       Bounce rate – the percentage of emails that bounced

•       Open rate – the percentage of delivered emails that were opened

•       Unique clicks – the number of recipients who clicked tracked links in the email

SMTP adds message-level troubleshooting information. Each SMTP message is assigned a Queue ID that can be used to trace it during a delivery investigation, and bounce information can include the recipient, timestamp, subject, and reason for the bounce.

In other words, choosing SMTP for convenience does not cost you delivery visibility.

If SMTP already works, why not run your own mail server?

An application that supports SMTP could connect to a self-managed mail transfer agent (MTA) such as Postfix or Sendmail. An MTA provides the basic infrastructure to accept and relay email, but operating email infrastructure involves more than running the software. Organizations also need to manage scaling, domain authentication, delivery monitoring, bounce and failure handling, security and compliance, sender reputation, support, maintenance and upgrades, and operational troubleshooting.

A managed service such as Event Notifications shifts much of that responsibility away from the application team while providing the delivery visibility described above, domain authentication, and integration with cloud workloads.

Can an organization use both?

Yes, and most will. A customer-facing application might send order confirmations through the API, while the operations team’s monitoring platform sends alerts through SMTP. Both use the same Event Notifications service, sending domain, and delivery metrics; each workload simply uses the interface that matches how it already works.

How do you choose?

Start with the application rather than the email service.

Choose API when:

•       You are building the application or control its code.

•       Email is part of the application’s business workflow, such as account creation, password resets, or order confirmations.

•       You want notification content and layout managed in templates, outside the application code.

•       Notifications are triggered by application events and carry structured data.

Choose SMTP when:

•       The application already supports SMTP and you want to minimize code changes.

•       You are connecting an existing enterprise or legacy application.

•       A monitoring or infrastructure tool already generates email.

•       A device or appliance offers SMTP configuration and nothing else.

Let the architecture drive the integration

API and SMTP are not competing answers to the same problem. They are two front doors to the same delivery service. An application built around structured events and programmatic workflows naturally integrates through the API and gains templates in the process. An existing application that already sends email connects through SMTP with minimal change and loses nothing in delivery visibility. An enterprise can, and usually will, use both.

With IBM Cloud Event Notifications, the integration model can follow the architecture of the workload rather than forcing every application into the same email-sending pattern. The key is not choosing between API and SMTP universally; it is choosing the interface that best fits how your application or system already works.

0 comments
10 views

Permalink