dvMailPriorityHeaders function

Map<String, String> dvMailPriorityHeaders(
  1. DVMailPriority priority
)

The headers that carry priority to a mail client.

No provider API here has a priority field, so priority travels as headers or not at all - and for a long while it was not at all. Three are emitted because no single one is universally honoured: X-Priority is what Outlook and most Windows clients read, Importance is the RFC 2156 header Gmail and Thunderbird prefer, and Priority (RFC 2156 too) is what a handful of gateways consult when ordering a queue.

Normal returns nothing. Stamping Importance: normal on every message adds bytes to every send, changes no client's behaviour, and gives spam filters that score explicit priority headers something to score - so the default stays silent.

Implementation

Map<String, String> dvMailPriorityHeaders(DVMailPriority priority) =>
    switch (priority) {
      DVMailPriority.high => const <String, String>{
          'X-Priority': '1 (Highest)',
          'Importance': 'high',
          'Priority': 'urgent',
        },
      DVMailPriority.low => const <String, String>{
          'X-Priority': '5 (Lowest)',
          'Importance': 'low',
          'Priority': 'non-urgent',
        },
      DVMailPriority.normal => const <String, String>{},
    };