Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eml attachments #47

Closed
podolinek opened this issue Nov 29, 2017 · 2 comments
Closed

eml attachments #47

podolinek opened this issue Nov 29, 2017 · 2 comments

Comments

@podolinek
Copy link
Contributor

@podolinek podolinek commented Nov 29, 2017

  • bug report? yes
  • feature request? yes
  • version: 2.4

Wrong content type for .eml files added as attachment

Hi, if you add eml file (mail file) to mail message attachments and send, some mail servers (in my case seznam.cz) reply me:

You message for <...@...> from 2017/11/29 could not be delivered.
It's attached below.

Důvod / Reason:
---------------

5.6.5 ebox; ebox: bad argument: Rfc822 message part can not be conbinated with base64 encoding.

It noticed me about wrong content type of attachment, which is "correctly" set as Rfc822, but this content type is not allowed for attached files.

Chapter 4.4 of whitepapers from microsoft describes how to fix it: change content-type to APPLICATION/OCTET-STREAM.

This should be fine implemented at nette mail for example at Message.php.

public function addAttachment($file, $content = null, $contentType = null) {
	$path = $file;
	$ext = Strings::lower(pathinfo($path, PATHINFO_EXTENSION));
	if ($ext == 'eml') {
		$contentType = $contentType ?? 'APPLICATION/OCTET-STREAM';
	}
	return $this->attachments[] = $this->createAttachment($file, $content, $contentType, 'attachment');
}

What do you think about this change?

Regards,
Ondrej

@dg dg closed this in a666e52 Dec 4, 2017
dg added a commit that referenced this issue Dec 4, 2017
@dg

This comment has been minimized.

Copy link
Member

@dg dg commented Dec 4, 2017

I fixed it a little differently, is it ok?

@podolinek

This comment has been minimized.

Copy link
Contributor Author

@podolinek podolinek commented Dec 4, 2017

David thanks,

great "low-level" implementation.

Ondrej

dg added a commit that referenced this issue Dec 5, 2017
dg added a commit that referenced this issue Dec 5, 2017
dg added a commit that referenced this issue Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.