Skip to content Skip to sidebar Skip to footer

what protocol sends email to a mail server quizlet

SMTP vs. Web API: The Best Methods for Sending Email

In part three/3 of our Email API series, nosotros'll be discussing SMTP Relay and Electronic mail APIs.

Tasia Potasinski | June 27, 2019

In part iii/three of our Email API serial, we'll be discussing SMTP Relay and Email APIs. You can reference the full series here:

Want a PDF of this article?

Share it with a friend or save it for later on reading.

  1. An Introduction to Email APIs
  2. Transactional vs. Contextual E-mail APIs
  3. SMTP vs. Web API (you're currently here!) ⭐️

Let'south dive in!

Sending email comes down to 1 of two protocols you'll want to develop effectually: the SMTP of email servers, or the HTTP of web servers. You may be familiar with the advantages of modernistic cloud APIs (if not, meet our before mail service explaining the topic), simply SMTP is the original protocol for sending email and nevertheless remains at the core of it all.

All email is ultimately sent by an email server co-ordinate to the rules of the Uncomplicated Mail service Transfer Protocol. It's a matter of whether you want to control this process yourself by handling your own SMTP interactions, or whether yous are comfortable handing over the SMTP transactions to an email provider, using their abstracted API instead. There are pros and cons to both approaches, so we'll explore them below.

Sending Email via SMTP

SMTP (the Elementary Mail Transfer Protocol) has been effectually for near four decades. It was divers every bit the internet standard protocol for email communications back in 1982 and is still the de facto protocol when sending or receiving email from exterior ane's own systems. SMTP specifies the rules, procedures, and components of an electronic mail message, and how to ship one in a standard format that tin exist interpreted by any other email server in a completely platform-agnostic fashion. Thanks to its ubiquity, a programmer can rely on fifty-fifty legacy devices existence able to handle SMTP sending.

After an email has been sent to the final destination mail server, the Internet Bulletin Access Protocol (IMAP) takes over to retrieve letters for private inboxes, where users can access and manage their mail service. In this article, we'll stay focused on the SMTP protocol, but check out our CTO & Co-founder Christine Spang's excellent deep dive into IMAP to learn more than nearly why IMAP is an of import part of receiving emails, just non always the easiest matter to implement (or sympathize).

For the time existence, permit's return to senders. Beneath is an instance of successfully sending an email to two mailboxes via SMTP. A software client (who has e-mail data to transport) opens a connection to an SMTP mail server, then sends a HELO code to let the mail service server know it wants to ship an email. The overall process involves many individual handshakes betwixt the client and server, as y'all'll run across below by the number of "250 Ok" responses needed to move each step forward.

Annotation: "S" refers to Server, "C" refers to Client, and the iii-digit numbers are the response codes.

=== Continued to smtp.example.com.

S: 220 smtp.example.com ESMTP Postfix

C: HELO relay.instance.com

S: 250 smtp.example.com, I am glad to come across you

C: Mail service FROM:<[email protected]>

S: 250 Ok

C: RCPT TO:<[email protected]>

South: 250 Ok

C: RCPT TO:<[email protected]>

Southward: 250 Ok

C: Data

Southward: 354 End information with <CR><LF>.<CR><LF>

C: From: "Bob Example" <[email protected]>

C: To: Alice Instance <[e-mail protected]>

C: Cc: [email protected]

C: Date: Tue, xv Jan 2008 16:02:43 -0500

C: Subject: Exam bulletin

C:

C: Hello Alice.

C: This is a examination message with five header fields and 4 lines in the message trunk.

C: Your friend,

C: Bob

C: .

S: 250 Ok: queued as 12345

C: QUIT

S: 221 Bye

Farther detail almost this SMTP example can be found on Wikipedia.

Aside on Response Codes

When yous send data or make a request with a message to a server somewhere, y'all will get a response code back that indicates whether your parcel of information was successfully received for the next relay or non. Codes are 3-digit numbers that give a broad indication of the status of the final message. For example, codes in the 200 range typically represent an "OK, continuing" response, whereas a response in the 400 or 500 ranges indicates a problem.

Difficulties When Using SMTP

  • SMTP offers the finest granularity in terms of control but demands a handshake for every footling interaction, which adds upwardly to a lot of network traffic overhead and more than potential points of failure that break the chain.
  • Mail Merges: You lot'll have full control over these and other advanced operations, but they require meticulous attending to set up correctly.

Sending Email via HTTP API

HTTP is a universal web protocol for all kinds of data, not just email. Whatsoever applications that make utilize of a customer-server calculating model, such as web apps, mobile apps, and even some IoT apps, apply HTTP. When using an HTTP API to send your e-mail data, you trust an intermediary service to take care of the SMTP details, e-mail deliverability, and email server workflows. Ultimately all your email letters will flow via SMTP at some signal in their journey, simply information technology is now up to you whether yous want to micromanage the SMTP message handling process or leave information technology upward to a third political party.

Developers integrating email functionality into a production will generally plough to an HTTP API. Besides offering a familiar convention (e.yard. Balance), HTTP APIs offered by mod e-mail providers offer a number of benefits that pure SMTP does not. Importantly, an API may offer other functionality outside of sending emails that complement related procedural tasks.

Cloud-based email API providers are unremarkably able to offering better delivery speeds and allow for your transactions to happen faster because there is less back and forth required than pure SMTP. This streamlining also minimizes the number of overall exchanges required when sending an email, thereby improving I/O. The Nylas E-mail API was created in part because these advantages accumulate at scale and can be most hands managed via a high-level API abstraction layer.

When y'all're interacting with a software application over the internet, you're using the standard protocol of spider web communications, HTTP (Hypertext Transfer Protocol). Whenever you lot visit a webpage, y'all're making use of HTTP communications to request and receive information. Ane advantage of using HTTP equally your protocol for sending e-mail data is that information technology is more than likely to be accepted compared to SMTP messages, which are commonly blocked by firewalls.

Beneath is an case of sending a message using an HTTP API:

POST /send HTTP/1.1

Host: api.nylas.com

Content-Blazon: awarding/json

Authorization: Basic WVVUW****

cache-control: no-enshroud

{

"reply_to_message_id": "7a893****"

}

One major advantage of using HTTP API over SMTP is that yous can choose to utilise API keys rather than auth-based Notation that information technology's also possible to use SMTP via an API. For example, if you are using the services of an email API platform, you lot tin use their SMTP API to instruct them to follow verbal SMTP specifications for sending & receiving your emails, without operating any of the email servers yourself. In essence, you are using an HTTP connection and an API abstraction to perform functions related to SMTP message treatment remotely.

Difficulties Using HTTP APIs for Electronic mail

  • Each new API requires a learning curve to learn its operations, and then practise your research into skillful vendors and make sure they offering high-quality API documentation.
  • You lot are at the mercy of a third-party intermediary, so y'all must be confident the provider is trustworthy.

Summary

When deciding which protocol to use, weigh these elements of your scenario:

  • The complexity of your employ case
  • Your bachelor resources, including developer expertise, the amount of time available to implement features, and your power or want to maintain the compages.
  • The relative importance of primal features, for example, sending speed and the ability to drift data.

Equally a dominion of thumb, SMTP is a suitable choice for simpler employ cases, while an HTTP API is a better choice for circuitous use cases or resource-constrained scenarios. With the variety and quality of spider web API providers available in a mature email technology industry, most developers today will choose to develop with an HTTP API, falling back on SMTP but when they need fine-grained command or additional redundancy assurances.

johnsonniguened1968.blogspot.com

Source: https://www.nylas.com/blog/smtp-vs.-web-api-the-best-methods-for-sending-email/

Kommentar veröffentlichen for "what protocol sends email to a mail server quizlet"