Should a use utf-8 or “utf-8” as a charset value in an email header?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







2















When sending an email to an Outlook.com with forwarding turned on, I find that the forwarded mail is rejected.



On examining the sent mail and the mail sitting in Outlook's inbox. I find that Microsoft have essentially re-written parts of the mail body.



For example



This is a multi-part message in MIME format.
--=_5226908e44ebc0462f06052400644d2f
Content-Type: multipart/alternative;
boundary="=_926d2a45bc543e1972443c87118fa61a"

--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset=utf-8

SGF2aW5nIGFub3RoZXIgZ28gYXQgZm9yd2FyZGluZyBhbiBlbWFpbCB2aWEgT3V0bG9vay4NCg0K
DQo=
--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/html; charset=utf-8


Becomes as follows; note the quotes around the charset value:



--=_5226908e44ebc0462f06052400644d2f
Content-Type: multipart/alternative;
boundary="=_926d2a45bc543e1972443c87118fa61a"

--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"

SGF2aW5nIGFub3RoZXIgZ28gYXQgZm9yd2FyZGluZyBhbiBlbWFpbCB2aWEgT3V0bG9vay4NCg0K
DQo=
--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/html; charset="utf-8"


Now aside from the fact that the mail RFC’s specifically forbid modifying the body anyway (which breaks the DKIM signature) I have to ask which is the correct way to write charset=utf-8 in an email header?










share|improve this question

























  • Outlook and Exchange do not retain the original E-Mail; this is well-defined behavior.

    – Daniel B
    Jan 29 at 16:25


















2















When sending an email to an Outlook.com with forwarding turned on, I find that the forwarded mail is rejected.



On examining the sent mail and the mail sitting in Outlook's inbox. I find that Microsoft have essentially re-written parts of the mail body.



For example



This is a multi-part message in MIME format.
--=_5226908e44ebc0462f06052400644d2f
Content-Type: multipart/alternative;
boundary="=_926d2a45bc543e1972443c87118fa61a"

--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset=utf-8

SGF2aW5nIGFub3RoZXIgZ28gYXQgZm9yd2FyZGluZyBhbiBlbWFpbCB2aWEgT3V0bG9vay4NCg0K
DQo=
--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/html; charset=utf-8


Becomes as follows; note the quotes around the charset value:



--=_5226908e44ebc0462f06052400644d2f
Content-Type: multipart/alternative;
boundary="=_926d2a45bc543e1972443c87118fa61a"

--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"

SGF2aW5nIGFub3RoZXIgZ28gYXQgZm9yd2FyZGluZyBhbiBlbWFpbCB2aWEgT3V0bG9vay4NCg0K
DQo=
--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/html; charset="utf-8"


Now aside from the fact that the mail RFC’s specifically forbid modifying the body anyway (which breaks the DKIM signature) I have to ask which is the correct way to write charset=utf-8 in an email header?










share|improve this question

























  • Outlook and Exchange do not retain the original E-Mail; this is well-defined behavior.

    – Daniel B
    Jan 29 at 16:25














2












2








2








When sending an email to an Outlook.com with forwarding turned on, I find that the forwarded mail is rejected.



On examining the sent mail and the mail sitting in Outlook's inbox. I find that Microsoft have essentially re-written parts of the mail body.



For example



This is a multi-part message in MIME format.
--=_5226908e44ebc0462f06052400644d2f
Content-Type: multipart/alternative;
boundary="=_926d2a45bc543e1972443c87118fa61a"

--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset=utf-8

SGF2aW5nIGFub3RoZXIgZ28gYXQgZm9yd2FyZGluZyBhbiBlbWFpbCB2aWEgT3V0bG9vay4NCg0K
DQo=
--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/html; charset=utf-8


Becomes as follows; note the quotes around the charset value:



--=_5226908e44ebc0462f06052400644d2f
Content-Type: multipart/alternative;
boundary="=_926d2a45bc543e1972443c87118fa61a"

--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"

SGF2aW5nIGFub3RoZXIgZ28gYXQgZm9yd2FyZGluZyBhbiBlbWFpbCB2aWEgT3V0bG9vay4NCg0K
DQo=
--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/html; charset="utf-8"


Now aside from the fact that the mail RFC’s specifically forbid modifying the body anyway (which breaks the DKIM signature) I have to ask which is the correct way to write charset=utf-8 in an email header?










share|improve this question
















When sending an email to an Outlook.com with forwarding turned on, I find that the forwarded mail is rejected.



On examining the sent mail and the mail sitting in Outlook's inbox. I find that Microsoft have essentially re-written parts of the mail body.



For example



This is a multi-part message in MIME format.
--=_5226908e44ebc0462f06052400644d2f
Content-Type: multipart/alternative;
boundary="=_926d2a45bc543e1972443c87118fa61a"

--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset=utf-8

SGF2aW5nIGFub3RoZXIgZ28gYXQgZm9yd2FyZGluZyBhbiBlbWFpbCB2aWEgT3V0bG9vay4NCg0K
DQo=
--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/html; charset=utf-8


Becomes as follows; note the quotes around the charset value:



--=_5226908e44ebc0462f06052400644d2f
Content-Type: multipart/alternative;
boundary="=_926d2a45bc543e1972443c87118fa61a"

--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"

SGF2aW5nIGFub3RoZXIgZ28gYXQgZm9yd2FyZGluZyBhbiBlbWFpbCB2aWEgT3V0bG9vay4NCg0K
DQo=
--=_926d2a45bc543e1972443c87118fa61a
Content-Transfer-Encoding: base64
Content-Type: text/html; charset="utf-8"


Now aside from the fact that the mail RFC’s specifically forbid modifying the body anyway (which breaks the DKIM signature) I have to ask which is the correct way to write charset=utf-8 in an email header?







email utf-8 outlook.com charset






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 29 at 16:21









JakeGould

32.8k10100142




32.8k10100142










asked Jan 29 at 16:01









ravenstar68ravenstar68

132




132













  • Outlook and Exchange do not retain the original E-Mail; this is well-defined behavior.

    – Daniel B
    Jan 29 at 16:25



















  • Outlook and Exchange do not retain the original E-Mail; this is well-defined behavior.

    – Daniel B
    Jan 29 at 16:25

















Outlook and Exchange do not retain the original E-Mail; this is well-defined behavior.

– Daniel B
Jan 29 at 16:25





Outlook and Exchange do not retain the original E-Mail; this is well-defined behavior.

– Daniel B
Jan 29 at 16:25










2 Answers
2






active

oldest

votes


















2














RFC2045 provides in section 5.1 the grammar used to construct valid Content-Type headers in MIME messages:



5.1.  Syntax of the Content-Type Header Field

In the Augmented BNF notation of RFC 822, a Content-Type header field
value is defined as follows:

content := "Content-Type" ":" type "/" subtype
*(";" parameter)
; Matching of media type and subtype
; is ALWAYS case-insensitive.

type := discrete-type / composite-type

discrete-type := "text" / "image" / "audio" / "video" /
"application" / extension-token

composite-type := "message" / "multipart" / extension-token

extension-token := ietf-token / x-token

ietf-token := <An extension token defined by a
standards-track RFC and registered
with IANA.>

x-token := <The two characters "X-" or "x-" followed, with
no intervening white space, by any token>

subtype := extension-token / iana-token

iana-token := <A publicly-defined extension token. Tokens
of this form must be registered with IANA
as specified in RFC 2048.>

parameter := attribute "=" value

attribute := token
; Matching of attributes
; is ALWAYS case-insensitive.

value := token / quoted-string

token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
or tspecials>

tspecials := "(" / ")" / "<" / ">" / "@" /
"," / ";" / ":" / "" / <">
"/" / "[" / "]" / "?" / "="
; Must be in quoted-string,
; to use within parameter values


Note how value is defined as token / quoted-string.



Further down in the section is a textual clarification with an example:



   Note that the value of a quoted string parameter does not include the
quotes. That is, the quotation marks in a quoted-string are not a
part of the value of the parameter, but are merely used to delimit
that parameter value. In addition, comments are allowed in
accordance with RFC 822 rules for structured header fields. Thus the
following two forms

Content-type: text/plain; charset=us-ascii (Plain text)

Content-type: text/plain; charset="us-ascii"

are completely equivalent.


As you can see, quoting is not required when the value already is a token (1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials>) but valid nonetheless.






share|improve this answer


























  • Thanks I think the updated RFC is 5322 - but the comment is still relevant nonetheless. In addition Microsoft decoded the base64 text of the body and then modified that too before re-encoding it back to base64. This is in direct contravention of RFC822 and 5322 which states an SMTP server must not modify the message except to add trace headers. As a result the forwarded mail was rejected by the server. I'll have to have a moan at them.

    – ravenstar68
    Jan 29 at 17:04











  • When forwarding the message, Outlook.com is not a relaying party.

    – Daniel B
    Jan 29 at 17:19











  • Depends how you set up the forwarding. If you use Rules then it forwards in the same way as if you'd manually forwarded the message. If you use the Forwarding settings, then it acts as a relay as far as the receiving server is concerned. The original DKIM header from my server is still there and that's used by the final server to check the mail body has been unaltered.

    – ravenstar68
    Jan 29 at 17:31



















1














Good question. In my experience, HTML email headers are not too much different than HTML (web server) headers so I would defer to the non-quoted version like this:



Content-Type: text/html; charset=utf-8


And digging deep into the RFC (RFC 2047) for MIME encoding I found this:



2. Syntax of encoded-words

An 'encoded-word' is defined by the following ABNF grammar. The
notation of RFC 822 is used, with the exception that white space
characters MUST NOT appear between components of an 'encoded-word'.

encoded-word = "=?" charset "?" encoding "?" encoded-text "?="

charset = token ; see section 3

encoding = token ; see section 4


At no point does it mention whether quoted token values are valid or not. So I am going to assume that Microsoft is somehow rewriting headers to have quoted values? No clue past the evidence that was provided, but I would defer to using the unquote value instead of defaulting to whatever Microsoft is doing.






share|improve this answer



















  • 1





    That’s not an encoded word. The relevant RFC is 2045, which further refers to RFC 822.

    – Daniel B
    Jan 29 at 16:30











  • @DanielB Fair enough. Upvoted your answer which is clearly far more on point.

    – JakeGould
    Jan 29 at 19:42












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1399707%2fshould-a-use-utf-8-or-utf-8-as-a-charset-value-in-an-email-header%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














RFC2045 provides in section 5.1 the grammar used to construct valid Content-Type headers in MIME messages:



5.1.  Syntax of the Content-Type Header Field

In the Augmented BNF notation of RFC 822, a Content-Type header field
value is defined as follows:

content := "Content-Type" ":" type "/" subtype
*(";" parameter)
; Matching of media type and subtype
; is ALWAYS case-insensitive.

type := discrete-type / composite-type

discrete-type := "text" / "image" / "audio" / "video" /
"application" / extension-token

composite-type := "message" / "multipart" / extension-token

extension-token := ietf-token / x-token

ietf-token := <An extension token defined by a
standards-track RFC and registered
with IANA.>

x-token := <The two characters "X-" or "x-" followed, with
no intervening white space, by any token>

subtype := extension-token / iana-token

iana-token := <A publicly-defined extension token. Tokens
of this form must be registered with IANA
as specified in RFC 2048.>

parameter := attribute "=" value

attribute := token
; Matching of attributes
; is ALWAYS case-insensitive.

value := token / quoted-string

token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
or tspecials>

tspecials := "(" / ")" / "<" / ">" / "@" /
"," / ";" / ":" / "" / <">
"/" / "[" / "]" / "?" / "="
; Must be in quoted-string,
; to use within parameter values


Note how value is defined as token / quoted-string.



Further down in the section is a textual clarification with an example:



   Note that the value of a quoted string parameter does not include the
quotes. That is, the quotation marks in a quoted-string are not a
part of the value of the parameter, but are merely used to delimit
that parameter value. In addition, comments are allowed in
accordance with RFC 822 rules for structured header fields. Thus the
following two forms

Content-type: text/plain; charset=us-ascii (Plain text)

Content-type: text/plain; charset="us-ascii"

are completely equivalent.


As you can see, quoting is not required when the value already is a token (1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials>) but valid nonetheless.






share|improve this answer


























  • Thanks I think the updated RFC is 5322 - but the comment is still relevant nonetheless. In addition Microsoft decoded the base64 text of the body and then modified that too before re-encoding it back to base64. This is in direct contravention of RFC822 and 5322 which states an SMTP server must not modify the message except to add trace headers. As a result the forwarded mail was rejected by the server. I'll have to have a moan at them.

    – ravenstar68
    Jan 29 at 17:04











  • When forwarding the message, Outlook.com is not a relaying party.

    – Daniel B
    Jan 29 at 17:19











  • Depends how you set up the forwarding. If you use Rules then it forwards in the same way as if you'd manually forwarded the message. If you use the Forwarding settings, then it acts as a relay as far as the receiving server is concerned. The original DKIM header from my server is still there and that's used by the final server to check the mail body has been unaltered.

    – ravenstar68
    Jan 29 at 17:31
















2














RFC2045 provides in section 5.1 the grammar used to construct valid Content-Type headers in MIME messages:



5.1.  Syntax of the Content-Type Header Field

In the Augmented BNF notation of RFC 822, a Content-Type header field
value is defined as follows:

content := "Content-Type" ":" type "/" subtype
*(";" parameter)
; Matching of media type and subtype
; is ALWAYS case-insensitive.

type := discrete-type / composite-type

discrete-type := "text" / "image" / "audio" / "video" /
"application" / extension-token

composite-type := "message" / "multipart" / extension-token

extension-token := ietf-token / x-token

ietf-token := <An extension token defined by a
standards-track RFC and registered
with IANA.>

x-token := <The two characters "X-" or "x-" followed, with
no intervening white space, by any token>

subtype := extension-token / iana-token

iana-token := <A publicly-defined extension token. Tokens
of this form must be registered with IANA
as specified in RFC 2048.>

parameter := attribute "=" value

attribute := token
; Matching of attributes
; is ALWAYS case-insensitive.

value := token / quoted-string

token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
or tspecials>

tspecials := "(" / ")" / "<" / ">" / "@" /
"," / ";" / ":" / "" / <">
"/" / "[" / "]" / "?" / "="
; Must be in quoted-string,
; to use within parameter values


Note how value is defined as token / quoted-string.



Further down in the section is a textual clarification with an example:



   Note that the value of a quoted string parameter does not include the
quotes. That is, the quotation marks in a quoted-string are not a
part of the value of the parameter, but are merely used to delimit
that parameter value. In addition, comments are allowed in
accordance with RFC 822 rules for structured header fields. Thus the
following two forms

Content-type: text/plain; charset=us-ascii (Plain text)

Content-type: text/plain; charset="us-ascii"

are completely equivalent.


As you can see, quoting is not required when the value already is a token (1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials>) but valid nonetheless.






share|improve this answer


























  • Thanks I think the updated RFC is 5322 - but the comment is still relevant nonetheless. In addition Microsoft decoded the base64 text of the body and then modified that too before re-encoding it back to base64. This is in direct contravention of RFC822 and 5322 which states an SMTP server must not modify the message except to add trace headers. As a result the forwarded mail was rejected by the server. I'll have to have a moan at them.

    – ravenstar68
    Jan 29 at 17:04











  • When forwarding the message, Outlook.com is not a relaying party.

    – Daniel B
    Jan 29 at 17:19











  • Depends how you set up the forwarding. If you use Rules then it forwards in the same way as if you'd manually forwarded the message. If you use the Forwarding settings, then it acts as a relay as far as the receiving server is concerned. The original DKIM header from my server is still there and that's used by the final server to check the mail body has been unaltered.

    – ravenstar68
    Jan 29 at 17:31














2












2








2







RFC2045 provides in section 5.1 the grammar used to construct valid Content-Type headers in MIME messages:



5.1.  Syntax of the Content-Type Header Field

In the Augmented BNF notation of RFC 822, a Content-Type header field
value is defined as follows:

content := "Content-Type" ":" type "/" subtype
*(";" parameter)
; Matching of media type and subtype
; is ALWAYS case-insensitive.

type := discrete-type / composite-type

discrete-type := "text" / "image" / "audio" / "video" /
"application" / extension-token

composite-type := "message" / "multipart" / extension-token

extension-token := ietf-token / x-token

ietf-token := <An extension token defined by a
standards-track RFC and registered
with IANA.>

x-token := <The two characters "X-" or "x-" followed, with
no intervening white space, by any token>

subtype := extension-token / iana-token

iana-token := <A publicly-defined extension token. Tokens
of this form must be registered with IANA
as specified in RFC 2048.>

parameter := attribute "=" value

attribute := token
; Matching of attributes
; is ALWAYS case-insensitive.

value := token / quoted-string

token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
or tspecials>

tspecials := "(" / ")" / "<" / ">" / "@" /
"," / ";" / ":" / "" / <">
"/" / "[" / "]" / "?" / "="
; Must be in quoted-string,
; to use within parameter values


Note how value is defined as token / quoted-string.



Further down in the section is a textual clarification with an example:



   Note that the value of a quoted string parameter does not include the
quotes. That is, the quotation marks in a quoted-string are not a
part of the value of the parameter, but are merely used to delimit
that parameter value. In addition, comments are allowed in
accordance with RFC 822 rules for structured header fields. Thus the
following two forms

Content-type: text/plain; charset=us-ascii (Plain text)

Content-type: text/plain; charset="us-ascii"

are completely equivalent.


As you can see, quoting is not required when the value already is a token (1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials>) but valid nonetheless.






share|improve this answer















RFC2045 provides in section 5.1 the grammar used to construct valid Content-Type headers in MIME messages:



5.1.  Syntax of the Content-Type Header Field

In the Augmented BNF notation of RFC 822, a Content-Type header field
value is defined as follows:

content := "Content-Type" ":" type "/" subtype
*(";" parameter)
; Matching of media type and subtype
; is ALWAYS case-insensitive.

type := discrete-type / composite-type

discrete-type := "text" / "image" / "audio" / "video" /
"application" / extension-token

composite-type := "message" / "multipart" / extension-token

extension-token := ietf-token / x-token

ietf-token := <An extension token defined by a
standards-track RFC and registered
with IANA.>

x-token := <The two characters "X-" or "x-" followed, with
no intervening white space, by any token>

subtype := extension-token / iana-token

iana-token := <A publicly-defined extension token. Tokens
of this form must be registered with IANA
as specified in RFC 2048.>

parameter := attribute "=" value

attribute := token
; Matching of attributes
; is ALWAYS case-insensitive.

value := token / quoted-string

token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
or tspecials>

tspecials := "(" / ")" / "<" / ">" / "@" /
"," / ";" / ":" / "" / <">
"/" / "[" / "]" / "?" / "="
; Must be in quoted-string,
; to use within parameter values


Note how value is defined as token / quoted-string.



Further down in the section is a textual clarification with an example:



   Note that the value of a quoted string parameter does not include the
quotes. That is, the quotation marks in a quoted-string are not a
part of the value of the parameter, but are merely used to delimit
that parameter value. In addition, comments are allowed in
accordance with RFC 822 rules for structured header fields. Thus the
following two forms

Content-type: text/plain; charset=us-ascii (Plain text)

Content-type: text/plain; charset="us-ascii"

are completely equivalent.


As you can see, quoting is not required when the value already is a token (1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials>) but valid nonetheless.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 29 at 19:41









JakeGould

32.8k10100142




32.8k10100142










answered Jan 29 at 16:37









Daniel BDaniel B

34.6k76587




34.6k76587













  • Thanks I think the updated RFC is 5322 - but the comment is still relevant nonetheless. In addition Microsoft decoded the base64 text of the body and then modified that too before re-encoding it back to base64. This is in direct contravention of RFC822 and 5322 which states an SMTP server must not modify the message except to add trace headers. As a result the forwarded mail was rejected by the server. I'll have to have a moan at them.

    – ravenstar68
    Jan 29 at 17:04











  • When forwarding the message, Outlook.com is not a relaying party.

    – Daniel B
    Jan 29 at 17:19











  • Depends how you set up the forwarding. If you use Rules then it forwards in the same way as if you'd manually forwarded the message. If you use the Forwarding settings, then it acts as a relay as far as the receiving server is concerned. The original DKIM header from my server is still there and that's used by the final server to check the mail body has been unaltered.

    – ravenstar68
    Jan 29 at 17:31



















  • Thanks I think the updated RFC is 5322 - but the comment is still relevant nonetheless. In addition Microsoft decoded the base64 text of the body and then modified that too before re-encoding it back to base64. This is in direct contravention of RFC822 and 5322 which states an SMTP server must not modify the message except to add trace headers. As a result the forwarded mail was rejected by the server. I'll have to have a moan at them.

    – ravenstar68
    Jan 29 at 17:04











  • When forwarding the message, Outlook.com is not a relaying party.

    – Daniel B
    Jan 29 at 17:19











  • Depends how you set up the forwarding. If you use Rules then it forwards in the same way as if you'd manually forwarded the message. If you use the Forwarding settings, then it acts as a relay as far as the receiving server is concerned. The original DKIM header from my server is still there and that's used by the final server to check the mail body has been unaltered.

    – ravenstar68
    Jan 29 at 17:31

















Thanks I think the updated RFC is 5322 - but the comment is still relevant nonetheless. In addition Microsoft decoded the base64 text of the body and then modified that too before re-encoding it back to base64. This is in direct contravention of RFC822 and 5322 which states an SMTP server must not modify the message except to add trace headers. As a result the forwarded mail was rejected by the server. I'll have to have a moan at them.

– ravenstar68
Jan 29 at 17:04





Thanks I think the updated RFC is 5322 - but the comment is still relevant nonetheless. In addition Microsoft decoded the base64 text of the body and then modified that too before re-encoding it back to base64. This is in direct contravention of RFC822 and 5322 which states an SMTP server must not modify the message except to add trace headers. As a result the forwarded mail was rejected by the server. I'll have to have a moan at them.

– ravenstar68
Jan 29 at 17:04













When forwarding the message, Outlook.com is not a relaying party.

– Daniel B
Jan 29 at 17:19





When forwarding the message, Outlook.com is not a relaying party.

– Daniel B
Jan 29 at 17:19













Depends how you set up the forwarding. If you use Rules then it forwards in the same way as if you'd manually forwarded the message. If you use the Forwarding settings, then it acts as a relay as far as the receiving server is concerned. The original DKIM header from my server is still there and that's used by the final server to check the mail body has been unaltered.

– ravenstar68
Jan 29 at 17:31





Depends how you set up the forwarding. If you use Rules then it forwards in the same way as if you'd manually forwarded the message. If you use the Forwarding settings, then it acts as a relay as far as the receiving server is concerned. The original DKIM header from my server is still there and that's used by the final server to check the mail body has been unaltered.

– ravenstar68
Jan 29 at 17:31













1














Good question. In my experience, HTML email headers are not too much different than HTML (web server) headers so I would defer to the non-quoted version like this:



Content-Type: text/html; charset=utf-8


And digging deep into the RFC (RFC 2047) for MIME encoding I found this:



2. Syntax of encoded-words

An 'encoded-word' is defined by the following ABNF grammar. The
notation of RFC 822 is used, with the exception that white space
characters MUST NOT appear between components of an 'encoded-word'.

encoded-word = "=?" charset "?" encoding "?" encoded-text "?="

charset = token ; see section 3

encoding = token ; see section 4


At no point does it mention whether quoted token values are valid or not. So I am going to assume that Microsoft is somehow rewriting headers to have quoted values? No clue past the evidence that was provided, but I would defer to using the unquote value instead of defaulting to whatever Microsoft is doing.






share|improve this answer



















  • 1





    That’s not an encoded word. The relevant RFC is 2045, which further refers to RFC 822.

    – Daniel B
    Jan 29 at 16:30











  • @DanielB Fair enough. Upvoted your answer which is clearly far more on point.

    – JakeGould
    Jan 29 at 19:42
















1














Good question. In my experience, HTML email headers are not too much different than HTML (web server) headers so I would defer to the non-quoted version like this:



Content-Type: text/html; charset=utf-8


And digging deep into the RFC (RFC 2047) for MIME encoding I found this:



2. Syntax of encoded-words

An 'encoded-word' is defined by the following ABNF grammar. The
notation of RFC 822 is used, with the exception that white space
characters MUST NOT appear between components of an 'encoded-word'.

encoded-word = "=?" charset "?" encoding "?" encoded-text "?="

charset = token ; see section 3

encoding = token ; see section 4


At no point does it mention whether quoted token values are valid or not. So I am going to assume that Microsoft is somehow rewriting headers to have quoted values? No clue past the evidence that was provided, but I would defer to using the unquote value instead of defaulting to whatever Microsoft is doing.






share|improve this answer



















  • 1





    That’s not an encoded word. The relevant RFC is 2045, which further refers to RFC 822.

    – Daniel B
    Jan 29 at 16:30











  • @DanielB Fair enough. Upvoted your answer which is clearly far more on point.

    – JakeGould
    Jan 29 at 19:42














1












1








1







Good question. In my experience, HTML email headers are not too much different than HTML (web server) headers so I would defer to the non-quoted version like this:



Content-Type: text/html; charset=utf-8


And digging deep into the RFC (RFC 2047) for MIME encoding I found this:



2. Syntax of encoded-words

An 'encoded-word' is defined by the following ABNF grammar. The
notation of RFC 822 is used, with the exception that white space
characters MUST NOT appear between components of an 'encoded-word'.

encoded-word = "=?" charset "?" encoding "?" encoded-text "?="

charset = token ; see section 3

encoding = token ; see section 4


At no point does it mention whether quoted token values are valid or not. So I am going to assume that Microsoft is somehow rewriting headers to have quoted values? No clue past the evidence that was provided, but I would defer to using the unquote value instead of defaulting to whatever Microsoft is doing.






share|improve this answer













Good question. In my experience, HTML email headers are not too much different than HTML (web server) headers so I would defer to the non-quoted version like this:



Content-Type: text/html; charset=utf-8


And digging deep into the RFC (RFC 2047) for MIME encoding I found this:



2. Syntax of encoded-words

An 'encoded-word' is defined by the following ABNF grammar. The
notation of RFC 822 is used, with the exception that white space
characters MUST NOT appear between components of an 'encoded-word'.

encoded-word = "=?" charset "?" encoding "?" encoded-text "?="

charset = token ; see section 3

encoding = token ; see section 4


At no point does it mention whether quoted token values are valid or not. So I am going to assume that Microsoft is somehow rewriting headers to have quoted values? No clue past the evidence that was provided, but I would defer to using the unquote value instead of defaulting to whatever Microsoft is doing.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 29 at 16:19









JakeGouldJakeGould

32.8k10100142




32.8k10100142








  • 1





    That’s not an encoded word. The relevant RFC is 2045, which further refers to RFC 822.

    – Daniel B
    Jan 29 at 16:30











  • @DanielB Fair enough. Upvoted your answer which is clearly far more on point.

    – JakeGould
    Jan 29 at 19:42














  • 1





    That’s not an encoded word. The relevant RFC is 2045, which further refers to RFC 822.

    – Daniel B
    Jan 29 at 16:30











  • @DanielB Fair enough. Upvoted your answer which is clearly far more on point.

    – JakeGould
    Jan 29 at 19:42








1




1





That’s not an encoded word. The relevant RFC is 2045, which further refers to RFC 822.

– Daniel B
Jan 29 at 16:30





That’s not an encoded word. The relevant RFC is 2045, which further refers to RFC 822.

– Daniel B
Jan 29 at 16:30













@DanielB Fair enough. Upvoted your answer which is clearly far more on point.

– JakeGould
Jan 29 at 19:42





@DanielB Fair enough. Upvoted your answer which is clearly far more on point.

– JakeGould
Jan 29 at 19:42


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1399707%2fshould-a-use-utf-8-or-utf-8-as-a-charset-value-in-an-email-header%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?