Content type key header added by iOS mail app contains ‘@yahoo.com’, - causing mail to get rejected by some IMAP servers.

Content type key header added by iOS mail app contains ‘@yahoo.com’, - causing mail to get rejected by some IMAP servers.

Issue is occurring on all iOS versions including 14.6, 14.7 betas, and iOS 15.0 betas.

On the iPhone, I am unable to forward a mail containing attachments received from a web browser based @yahoo.com or @icloud.com mail account.

When the iPhone native mail app forwards a mail received from @yahoo.com or @icloud.com mail account using a web browser like Safari, it adds the following header content to the mail: 

Header added by iPhone mail app:


--Apple-Mail-91EF9D82-D8B5-41DD-A98A-69489ED47254

Content-Type: image/jpeg;

name=image0.jpeg;

x-apple-part-url="xxxx-yyyy-zzzz@yahoo.com"

Content-Disposition: inline;

filename=image0.jpeg

Content-Transfer-Encoding: base64

Content-Id: xxxx-yyyy-zzzz[AT]yahoo.com

The header added by iPhone mail app is rejected by some third party IMAP mail accounts who reject the message from iOS mail app. The error message generated at IMAP mail servers is as follows:

Mail send failure log:


Action: failed

Status: 5.0.0 (permanent failure)

Remote-MTA: dns; [***.***.***.***]

Diagnostic-Code: smtp; 5.3.0 - Other mail system problem 550-'5.7.1 Attachment type not allowed. File "image0.jpeg;  x-apple-part-url="xxxxxxx-yyyyy[AT]yahoo.com" has the unacceptable extension "com"' (delivery attempts: 0)

Is the error of mail rejection on account of iPhone incorrectly adding the header, or is the mail server behaving incorrectly by wrongly rejecting the mail?

This isn't directly an answer to your question but i'm sharing to help other people who find this and run mail servers: Our mail server's postfix filter in /etc/postfix/mime_header_checks was:

/^\s*Content-(Disposition|Type).*name\s*=\s*"?(.*\.(ade|adp|bas|bat|chm|cmd|com|cpl|crt|dll|exe|hlp|hta|inf|ins|isp|js|jse|lnk|mdb|mde|mdt|mdw|msc|msi|msp|mst|nws|ops|pcd|pif|prf|reg|scf|scr\??|sct|shb|shs|shm|swf|vb[esx]?|vxd|wsc|wsf|wsh))(\?=)?"?\s*(;|$)/x REJECT Attachment name "$2" may not end with ".$3"

We changed it to the following to avoid this issue:

/^\s*Content-(Disposition|Type)[^;]*;name\s*=\s*"?([^;]*\.(ade|adp|bas|bat|chm|cmd|com|cpl|crt|dll|exe|hlp|hta|inf|ins|isp|js|jse|lnk|mdb|mde|mdt|mdw|msc|msi|msp|mst|nws|ops|pcd|pif|prf|reg|scf|scr\??|sct|shb|shs|sh|shm|swf|vb[esx]?|vxd|wsc|wsf|wsh)\b)(\?=)?"?\s*(;|$)/x REJECT Attachment name "$2" may not end with ".$3"
Content type key header added by iOS mail app contains ‘@yahoo.com’, - causing mail to get rejected by some IMAP servers.
 
 
Q