#[non_exhaustive]pub enum HeaderName<'x> {
Show 253 variants
Subject,
From,
To,
Cc,
Date,
Bcc,
ReplyTo,
Sender,
Comments,
InReplyTo,
Keywords,
Received,
MessageId,
References,
ReturnPath,
MimeVersion,
ContentDescription,
ContentId,
ContentLanguage,
ContentLocation,
ContentTransferEncoding,
ContentType,
ContentDisposition,
ResentTo,
ResentFrom,
ResentBcc,
ResentCc,
ResentSender,
ResentDate,
ResentMessageId,
ListArchive,
ListHelp,
ListId,
ListOwner,
ListPost,
ListSubscribe,
ListUnsubscribe,
DkimSignature,
ArcAuthenticationResults,
ArcMessageSignature,
ArcSeal,
Dkim2Signature,
MessageInstance,
AcceptLanguage,
AlternateRecipient,
ArchivedAt,
AuthenticationResults,
AutoSubmitted,
Autoforwarded,
Autosubmitted,
ContentAlternative,
ContentDuration,
ContentFeatures,
ContentMd5,
ContentTranslationType,
Conversion,
ConversionWithLoss,
DlExpansionHistory,
DeferredDelivery,
DeliveryDate,
DiscardedX400IpmsExtensions,
DiscardedX400MtsExtensions,
DiscloseRecipients,
DispositionNotificationOptions,
DispositionNotificationTo,
DowngradedFinalRecipient,
DowngradedInReplyTo,
DowngradedMessageId,
DowngradedOriginalRecipient,
DowngradedReferences,
Encoding,
Expires,
GenerateDeliveryReport,
HpOuter,
Importance,
IncompleteCopy,
Language,
LatestDeliveryTime,
ListUnsubscribePost,
MessageContext,
MessageType,
MmhsExemptedAddress,
MmhsExtendedAuthorisationInfo,
MmhsSubjectIndicatorCodes,
MmhsHandlingInstructions,
MmhsMessageInstructions,
MmhsCodressMessageIndicator,
MmhsOriginatorReference,
MmhsPrimaryPrecedence,
MmhsCopyPrecedence,
MmhsMessageType,
MmhsOtherRecipientsIndicatorTo,
MmhsOtherRecipientsIndicatorCc,
MmhsAcp127MessageIdentifier,
MmhsOriginatorPlad,
MtPriority,
Organization,
OriginalEncodedInformationTypes,
OriginalFrom,
OriginalMessageId,
OriginalRecipient,
OriginatorReturnAddress,
OriginalSubject,
PicsLabel,
PreventNonDeliveryReport,
Priority,
ReceivedSpf,
ReplyBy,
RequireRecipientValidSince,
Sensitivity,
Solicitation,
Supersedes,
TlsReportDomain,
TlsReportSubmitter,
TlsRequired,
VbrInfo,
X400ContentIdentifier,
X400ContentReturn,
X400ContentType,
X400MtsIdentifier,
X400Originator,
X400Received,
X400Recipients,
X400Trace,
ApparentlyTo,
Author,
CfblAddress,
CfblFeedbackId,
DeliveredTo,
EdiintFeatures,
EesstVersion,
ErrorsTo,
Face,
FormSub,
JabberId,
MmhsAuthorizingUsers,
Privicon,
SioLabel,
SioLabelHistory,
WrongRecipient,
XOriginalTo,
ReturnReceiptTo,
XSpamStatus,
XSpamScore,
XSpamFlag,
XSpamResult,
XPriority,
XMSMailPriority,
XMailer,
UserAgent,
XMimeOLE,
XOriginatingIp,
XForwardedTo,
XForwardedFor,
XAutoResponseSuppress,
Precedence,
ThreadIndex,
ThreadTopic,
FeedbackId,
XUniversallyUniqueIdentifier,
XVirusScanned,
XMailFrom,
XMailmanVersion,
MessageIdHash,
XMessageIdHash,
XMailmanRuleMisses,
XSpamLevel,
XReceived,
XGmMessageState,
XGoogleDkimSignature,
XMailboxLine,
XGmGg,
XOriginalFrom,
XGoogleSmtpSource,
XMsTnefCorrelator,
XMsHasAttach,
XMeProxy,
XMeProxyCause,
XMeSender,
XGmFeatures,
XMsExchangeTransportCrossTenantHeadersStamped,
XMsPublicTrafficType,
XOriginatorOrg,
XMsExchangeCrossTenantNetworkMessageId,
XMsExchangeCrossTenantAuthSource,
XMsExchangeCrossTenantAuthAs,
XMsExchangeCrossTenantOriginalArrivalTime,
XMicrosoftAntispam,
XMsExchangeCrossTenantId,
XMsTrafficTypeDiagnostic,
XMicrosoftAntispamMessageInfo,
XMsOffice365FilteringCorrelationId,
XMsExchangeCrossTenantFromEntityHeader,
XMsExchangeAntiSpamMessageDataChunkCount,
XMsExchangeAntiSpamMessageData0,
XMsExchangeSenderADCheck,
XForefrontAntispamReport,
XMsExchangeAntiSpamRelay,
XMsExchangeCrossTenantMailboxType,
XMsExchangeCrossTenantUserPrincipalName,
XGitHubReason,
XGitHubRecipientAddress,
XGitHubRecipient,
Destinations,
XGitHubSender,
XGitHubNotifyPlatform,
XThreadId,
XSesOutgoing,
XProofpointVirusVersion,
XGitHubAssignees,
XGitHubLabels,
BimiSelector,
XStripeEid,
XAttachmentId,
XTestIDTracker,
XIetfIDTracker,
XPmMessageId,
XAntiAbuse,
Autocrypt,
XComplaintsTo,
XProofpointOrigGuid,
XProofpointGuid,
XGitHubIssueState,
XMsReactions,
XPmMtaPool,
XPmRcpt,
XProofpointSpamDetailsEnc,
XPmMessageOptions,
XSenderId,
XGitHubPullRequestStatus,
XAuthorityAnalysis,
XForwardedEncrypted,
XMsExchangeAntiSpamExternalHopMessageDataChunkCount,
XMsExchangeAntiSpamExternalHopMessageData0,
XMsExchangeCrossTenantRmsPersistedConsumerOrg,
XExchangeRoutingPolicyChecked,
XMsExchangeCrossTenantOriginalAttributedTenantConnectingIp,
XMsExchangeMessageSentRepresentingType,
XMsExchangeTransportCrossTenantHeadersStripped,
XMsOffice365FilteringCorrelationIdPrvs,
XMicrosoftAntispamMessageInfoOriginal,
XMsExchangeAuthenticationResults,
XForefrontAntispamReportUntrusted,
XMsExchangeAtpMessageProperties,
XMicrosoftAntispamUntrusted,
XMsExchangeAntiSpamMessageData1,
XMissiveId,
XIadbIpReverse,
XReportAbuse,
DkimFilter,
XMeReceived,
XProofpointSpamDetails,
Other(Cow<'x, str>),
}Expand description
A header field name: one of the known names, or any other name with its original spelling.
Names compare ASCII case-insensitively, so Other("x-custom")
equals Other("X-Custom"), and an Other spelled like a known
name equals, hashes and orders as that name. Known names are
parsed into their variant by HeaderName::parse, by the From
conversions (which keep any other string as written in Other)
and by the message parser, and keep their canonical spelling in
HeaderName::as_str; crate::Header::raw_name gives the
spelling used in a message.
use mail_parser::HeaderName;
assert_eq!(HeaderName::parse("content-type"), Some(HeaderName::ContentType));
assert_eq!(HeaderName::ContentType.as_str(), "Content-Type");
let custom = HeaderName::parse("X-Custom").expect("valid name");
assert!(custom.is_other());
assert_eq!(custom, HeaderName::from("x-custom"));Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Subject
Subject.
From
From.
To
To.
Cc
Cc.
Date
Date.
Bcc
Bcc.
ReplyTo
Reply-To.
Sender
Sender.
Comments
Comments.
InReplyTo
In-Reply-To.
Keywords
Keywords.
Received
Received.
MessageId
Message-ID.
References
References.
ReturnPath
Return-Path.
MimeVersion
MIME-Version.
ContentDescription
Content-Description.
ContentId
Content-ID.
ContentLanguage
Content-Language.
ContentLocation
Content-Location.
ContentTransferEncoding
Content-Transfer-Encoding.
ContentType
Content-Type.
ContentDisposition
Content-Disposition.
ResentTo
Resent-To.
ResentFrom
Resent-From.
ResentBcc
Resent-Bcc.
ResentCc
Resent-Cc.
ResentSender
Resent-Sender.
ResentDate
Resent-Date.
ResentMessageId
Resent-Message-ID.
ListArchive
List-Archive.
ListHelp
List-Help.
ListId
List-ID.
ListOwner
List-Owner.
ListPost
List-Post.
ListSubscribe
List-Subscribe.
ListUnsubscribe
List-Unsubscribe.
DkimSignature
DKIM-Signature.
ArcAuthenticationResults
ARC-Authentication-Results.
ArcMessageSignature
ARC-Message-Signature.
ArcSeal
ARC-Seal.
Dkim2Signature
DKIM2-Signature.
MessageInstance
Message-Instance.
AcceptLanguage
Accept-Language.
AlternateRecipient
Alternate-Recipient.
ArchivedAt
Archived-At.
AuthenticationResults
Authentication-Results.
AutoSubmitted
Auto-Submitted.
Autoforwarded
Autoforwarded.
Autosubmitted
Autosubmitted.
ContentAlternative
Content-Alternative.
ContentDuration
Content-Duration.
ContentFeatures
Content-features.
ContentMd5
Content-MD5.
ContentTranslationType
Content-Translation-Type.
Conversion
Conversion.
ConversionWithLoss
Conversion-With-Loss.
DlExpansionHistory
DL-Expansion-History.
DeferredDelivery
Deferred-Delivery.
DeliveryDate
Delivery-Date.
DiscardedX400IpmsExtensions
Discarded-X400-IPMS-Extensions.
DiscardedX400MtsExtensions
Discarded-X400-MTS-Extensions.
DiscloseRecipients
Disclose-Recipients.
DispositionNotificationOptions
Disposition-Notification-Options.
DispositionNotificationTo
Disposition-Notification-To.
DowngradedFinalRecipient
Downgraded-Final-Recipient.
DowngradedInReplyTo
Downgraded-In-Reply-To.
DowngradedMessageId
Downgraded-Message-Id.
DowngradedOriginalRecipient
Downgraded-Original-Recipient.
DowngradedReferences
Downgraded-References.
Encoding
Encoding.
Expires
Expires.
GenerateDeliveryReport
Generate-Delivery-Report.
HpOuter
HP-Outer.
Importance
Importance.
IncompleteCopy
Incomplete-Copy.
Language
Language.
LatestDeliveryTime
Latest-Delivery-Time.
ListUnsubscribePost
List-Unsubscribe-Post.
MessageContext
Message-Context.
MessageType
Message-Type.
MmhsExemptedAddress
MMHS-Exempted-Address.
MmhsExtendedAuthorisationInfo
MMHS-Extended-Authorisation-Info.
MmhsSubjectIndicatorCodes
MMHS-Subject-Indicator-Codes.
MmhsHandlingInstructions
MMHS-Handling-Instructions.
MmhsMessageInstructions
MMHS-Message-Instructions.
MmhsCodressMessageIndicator
MMHS-Codress-Message-Indicator.
MmhsOriginatorReference
MMHS-Originator-Reference.
MmhsPrimaryPrecedence
MMHS-Primary-Precedence.
MmhsCopyPrecedence
MMHS-Copy-Precedence.
MmhsMessageType
MMHS-Message-Type.
MmhsOtherRecipientsIndicatorTo
MMHS-Other-Recipients-Indicator-To.
MmhsOtherRecipientsIndicatorCc
MMHS-Other-Recipients-Indicator-CC.
MmhsAcp127MessageIdentifier
MMHS-Acp127-Message-Identifier.
MmhsOriginatorPlad
MMHS-Originator-PLAD.
MtPriority
MT-Priority.
Organization
Organization.
OriginalEncodedInformationTypes
Original-Encoded-Information-Types.
OriginalFrom
Original-From.
OriginalMessageId
Original-Message-ID.
OriginalRecipient
Original-Recipient.
OriginatorReturnAddress
Originator-Return-Address.
OriginalSubject
Original-Subject.
PicsLabel
PICS-Label.
PreventNonDeliveryReport
Prevent-NonDelivery-Report.
Priority
Priority.
ReceivedSpf
Received-SPF.
ReplyBy
Reply-By.
RequireRecipientValidSince
Require-Recipient-Valid-Since.
Sensitivity
Sensitivity.
Solicitation
Solicitation.
Supersedes
Supersedes.
TlsReportDomain
TLS-Report-Domain.
TlsReportSubmitter
TLS-Report-Submitter.
TlsRequired
TLS-Required.
VbrInfo
VBR-Info.
X400ContentIdentifier
X400-Content-Identifier.
X400ContentReturn
X400-Content-Return.
X400ContentType
X400-Content-Type.
X400MtsIdentifier
X400-MTS-Identifier.
X400Originator
X400-Originator.
X400Received
X400-Received.
X400Recipients
X400-Recipients.
X400Trace
X400-Trace.
ApparentlyTo
Apparently-To.
Author
Author.
CfblAddress
CFBL-Address.
CfblFeedbackId
CFBL-Feedback-ID.
DeliveredTo
Delivered-To.
EdiintFeatures
EDIINT-Features.
EesstVersion
Eesst-Version.
ErrorsTo
Errors-To.
Face
Face.
FormSub
Form-Sub.
JabberId
Jabber-ID.
MmhsAuthorizingUsers
MMHS-Authorizing-Users.
Privicon
Privicon.
SioLabel
SIO-Label.
SioLabelHistory
SIO-Label-History.
WrongRecipient
Wrong-Recipient.
XOriginalTo
X-Original-To.
ReturnReceiptTo
Return-Receipt-To.
XSpamStatus
X-Spam-Status.
XSpamScore
X-Spam-Score.
XSpamFlag
X-Spam-Flag.
XSpamResult
X-Spam-Result.
XPriority
X-Priority.
XMSMailPriority
X-MSMail-Priority.
XMailer
X-Mailer.
UserAgent
User-Agent.
XMimeOLE
X-MimeOLE.
XOriginatingIp
X-Originating-IP.
XForwardedTo
X-Forwarded-To.
XForwardedFor
X-Forwarded-For.
XAutoResponseSuppress
X-Auto-Response-Suppress.
Precedence
Precedence.
ThreadIndex
Thread-Index.
ThreadTopic
Thread-Topic.
FeedbackId
Feedback-ID.
XUniversallyUniqueIdentifier
X-Universally-Unique-Identifier.
XVirusScanned
X-Virus-Scanned.
XMailFrom
X-MailFrom.
XMailmanVersion
X-Mailman-Version.
MessageIdHash
Message-ID-Hash.
XMessageIdHash
X-Message-ID-Hash.
XMailmanRuleMisses
X-Mailman-Rule-Misses.
XSpamLevel
X-Spam-Level.
XReceived
X-Received.
XGmMessageState
X-Gm-Message-State.
XGoogleDkimSignature
X-Google-DKIM-Signature.
XMailboxLine
X-Mailbox-Line.
XGmGg
X-Gm-Gg.
XOriginalFrom
X-Original-From.
XGoogleSmtpSource
X-Google-Smtp-Source.
XMsTnefCorrelator
X-MS-TNEF-Correlator.
XMsHasAttach
X-MS-Has-Attach.
XMeProxy
X-ME-Proxy.
XMeProxyCause
X-ME-Proxy-Cause.
XMeSender
X-ME-Sender.
XGmFeatures
X-Gm-Features.
XMsExchangeTransportCrossTenantHeadersStamped
X-MS-Exchange-Transport-CrossTenantHeadersStamped.
XMsPublicTrafficType
X-MS-PublicTrafficType.
XOriginatorOrg
X-OriginatorOrg.
XMsExchangeCrossTenantNetworkMessageId
X-MS-Exchange-CrossTenant-Network-Message-Id.
XMsExchangeCrossTenantAuthSource
X-MS-Exchange-CrossTenant-AuthSource.
XMsExchangeCrossTenantAuthAs
X-MS-Exchange-CrossTenant-AuthAs.
XMsExchangeCrossTenantOriginalArrivalTime
X-MS-Exchange-CrossTenant-OriginalArrivalTime.
XMicrosoftAntispam
X-Microsoft-Antispam.
XMsExchangeCrossTenantId
X-MS-Exchange-CrossTenant-Id.
XMsTrafficTypeDiagnostic
X-MS-TrafficTypeDiagnostic.
XMicrosoftAntispamMessageInfo
X-Microsoft-Antispam-Message-Info.
XMsOffice365FilteringCorrelationId
X-MS-Office365-Filtering-Correlation-Id.
XMsExchangeCrossTenantFromEntityHeader
X-MS-Exchange-CrossTenant-FromEntityHeader.
XMsExchangeAntiSpamMessageDataChunkCount
X-MS-Exchange-AntiSpam-MessageData-ChunkCount.
XMsExchangeAntiSpamMessageData0
X-MS-Exchange-AntiSpam-MessageData-0.
XMsExchangeSenderADCheck
X-MS-Exchange-SenderADCheck.
XForefrontAntispamReport
X-Forefront-Antispam-Report.
XMsExchangeAntiSpamRelay
X-MS-Exchange-AntiSpam-Relay.
XMsExchangeCrossTenantMailboxType
X-MS-Exchange-CrossTenant-MailboxType.
XMsExchangeCrossTenantUserPrincipalName
X-MS-Exchange-CrossTenant-UserPrincipalName.
XGitHubReason
X-GitHub-Reason.
XGitHubRecipientAddress
X-GitHub-Recipient-Address.
XGitHubRecipient
X-GitHub-Recipient.
Destinations
Destinations.
XGitHubSender
X-GitHub-Sender.
XGitHubNotifyPlatform
X-GitHub-Notify-Platform.
XThreadId
X-ThreadId.
XSesOutgoing
X-SES-Outgoing.
XProofpointVirusVersion
X-Proofpoint-Virus-Version.
XGitHubAssignees
X-GitHub-Assignees.
XGitHubLabels
X-GitHub-Labels.
BimiSelector
BIMI-Selector.
XStripeEid
X-Stripe-EID.
XAttachmentId
X-Attachment-Id.
XTestIDTracker
X-Test-IDTracker.
XIetfIDTracker
X-IETF-IDTracker.
XPmMessageId
X-Pm-Message-ID.
XAntiAbuse
X-AntiAbuse.
Autocrypt
Autocrypt.
XComplaintsTo
X-Complaints-To.
XProofpointOrigGuid
X-Proofpoint-ORIG-GUID.
XProofpointGuid
X-Proofpoint-GUID.
XGitHubIssueState
X-GitHub-IssueState.
XMsReactions
X-MS-Reactions.
XPmMtaPool
X-Pm-MTA-Pool.
XPmRcpt
X-Pm-RCPT.
XProofpointSpamDetailsEnc
X-Proofpoint-Spam-Details-Enc.
XPmMessageOptions
X-Pm-Message-Options.
XSenderId
X-Sender-ID.
XGitHubPullRequestStatus
X-GitHub-PullRequestStatus.
XAuthorityAnalysis
X-Authority-Analysis.
XForwardedEncrypted
X-Forwarded-Encrypted.
XMsExchangeAntiSpamExternalHopMessageDataChunkCount
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount.
XMsExchangeAntiSpamExternalHopMessageData0
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0.
XMsExchangeCrossTenantRmsPersistedConsumerOrg
X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg.
XExchangeRoutingPolicyChecked
X-Exchange-RoutingPolicyChecked.
XMsExchangeCrossTenantOriginalAttributedTenantConnectingIp
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp.
XMsExchangeMessageSentRepresentingType
X-MS-Exchange-MessageSentRepresentingType.
XMsExchangeTransportCrossTenantHeadersStripped
X-MS-Exchange-Transport-CrossTenantHeadersStripped.
XMsOffice365FilteringCorrelationIdPrvs
X-MS-Office365-Filtering-Correlation-Id-Prvs.
XMicrosoftAntispamMessageInfoOriginal
X-Microsoft-Antispam-Message-Info-Original.
XMsExchangeAuthenticationResults
X-MS-Exchange-Authentication-Results.
XForefrontAntispamReportUntrusted
X-Forefront-Antispam-Report-Untrusted.
XMsExchangeAtpMessageProperties
X-MS-Exchange-AtpMessageProperties.
XMicrosoftAntispamUntrusted
X-Microsoft-Antispam-Untrusted.
XMsExchangeAntiSpamMessageData1
X-MS-Exchange-AntiSpam-MessageData-1.
XMissiveId
X-Missive-Id.
XIadbIpReverse
X-IADB-IP-Reverse.
XReportAbuse
X-Report-Abuse.
DkimFilter
DKIM-Filter.
XMeReceived
X-ME-Received.
XProofpointSpamDetails
X-Proofpoint-Spam-Details.
Other(Cow<'x, str>)
Any other name, with its original spelling.
Implementations§
Source§impl<'x> HeaderName<'x>
impl<'x> HeaderName<'x>
Sourcepub fn parse(name: impl Into<Cow<'x, str>>) -> Option<HeaderName<'x>>
pub fn parse(name: impl Into<Cow<'x, str>>) -> Option<HeaderName<'x>>
Parses a header name. Returns None for an empty name or one with a
byte that RFC 5322 does not allow in a field name (anything but
printable US-ASCII other than the colon). Never allocates.
Sourcepub fn key(&self) -> HeaderKey<'_>
pub fn key(&self) -> HeaderKey<'_>
Resolves the name once, for code that looks the same name up in many
parts or messages: crate::Headers::all_key and
crate::Headers::get_key then skip the name lookup that
crate::Headers::all and crate::Headers::get do on every call.
use mail_parser::{HeaderName, MessageParser};
let message = MessageParser::new()
.parse(b"X-Tag: a\r\nX-Tag: b\r\n\r\nbody")
.expect("message");
let name = HeaderName::from("x-tag");
let key = name.key();
assert_eq!(message.headers().all_key(key).count(), 2);
assert_eq!(
message.headers().get_key(key).map(|header| header.raw_value()),
Some(&b" b\r\n"[..])
);Sourcepub fn into_owned(self) -> HeaderName<'static>
pub fn into_owned(self) -> HeaderName<'static>
Converts the name into one that owns its spelling.
Sourcepub fn as_static_str(&self) -> &'static str
pub fn as_static_str(&self) -> &'static str
Canonical spelling of a known name; empty for other names.
Sourcepub fn as_str(&self) -> &str
pub fn as_str(&self) -> &str
Canonical spelling of a known name, or the original spelling of any other name.
Sourcepub fn is_mime_header(&self) -> bool
pub fn is_mime_header(&self) -> bool
Whether this is one of the seven Content-* MIME header fields.
Sourcepub fn is_content_header(&self) -> bool
pub fn is_content_header(&self) -> bool
Whether this is any Content-* header field, known or not: the
fields that describe a part’s content and do not survive replacing it.
Sourcepub fn is_structured(&self) -> bool
pub fn is_structured(&self) -> bool
Whether the default parser yields a structured value for this name.