{emayili} Message Precedence

Sometimes you need to have a message delivered immediately. Other times it doesn’t matter when it’s delivered. Similarly, you might want the recipient to read a message immediately. Or you may not really care when they read it. The ability to specify message priority and importance in {emayili} has been added to address both scenarios.

library(emayili)

packageVersion("emayili")
[1] '0.6.1'

Importance

The Importance header specifies how important a message is (surprise!). It reflects how important the sender thinks the message is, which might not necessarily agree with the recipient’s opinion. According to RFC 4021 this (optional) field can assume one of three values: low, normal or high.

In {emayili} you can set the importance either when creating a message or later.

# Set importance when creating message.
envelope(importance = "low")

# Set importance later.
envelope() %>% importance("high")

Priority

The Priority header is a hint to the mail delivery system about how urgent the message is. Presumably for servers processing a high volume of emails this might influence whether the message is sent immediately or queued to be processed later. According to RFC 4021 this (optional) field can assume one of three values: non-urgent, normal or urgent.

In {emayili} you can set the priority either when creating a message or later.

# Set priority when creating message.
envelope(priority = "non-urgent")

# Set priority later.
envelope() %>% priority("urgent")

An Important and Urgent Message

If you had an important message, you might construct it as follows:

envelope() %>%
  to("edward.smith@titanic.com") %>%
  subject("We've hit an iceberg!") %>%
  priority("urgent") %>%
  importance("high")
Date:                         Sun, 10 Nov 2024 04:52:45 GMT
X-Mailer:                     {emayili}-0.9.1
MIME-Version:                 1.0
To:                           edward.smith@titanic.com
Subject:                      We've hit an iceberg!
Priority:                     urgent
Importance:                   high

It’s important to bear in mind that neither of these fields is binding. They are really only suggestions and can easily be ignored by either server or recipient.