-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
message body parts should be a sub body #376
message body parts should be a sub body #376
Conversation
@@ -160,17 +160,15 @@ def raw_message | |||
mail.sender = @sender | |||
mail.subject = @subject | |||
mail.reply_to = @reply_to | |||
if @html_body.blank? && attachments.empty? | |||
mail.body = @plain_body |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this outer condition that checks for plain text only messages should still exist. There's no reason to use multipart/alternative
for those, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was initially erring on the side of caution but also the comment I linked to from the issue suggests that if you include a text/plain attachment without this arrangement, the attachment can get lost on some platforms.
Either way, its better to clearly define the parts within a message as theres no knowing what email software and servers will be involved in the passage of the message to its recipient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm !
when will this get merged? |
Any news? |
I also discovered this issue and am interested in seeing this get merged. Also, I manually applied this fix to my install and it resolved my issue. |
@naft-a What is stopping this pull request from getting merged? |
I'd say the main thing holding this up is that we likely don't want plain text only e-mails to be within the multipart/alternative block.
This should be the behaviour of |
I've just tested this, and it doesn't appear that this patch is necessary. The current behaviour using the current mail gem appears to already be what this pull request aims to create:
|
@alexander-rieder Are you seeing some behaviour that implies that this is not working correctly? |
@catphish not quite - your example doesn't involve attachments which is the crux of the issue. I've created a gist with a minimal repro using the mail gem directly, in an identical way to Postal before and after this PR. It outputs two eml files, one of which has an invalid structure. The root part of test-broken.eml is
It looks like this was reported to the gem back in 2013 but closed by the gem author as not a bug. The gem author wants the user to create the mixed wrapper themselves. The change by @willpower232 implements this. We work on a similar closed-source project that parses, transforms and then outputs mime messages through a custom SMTP server. We've had similar problems with attachments and inline images in some clients (looking at you Apple Mail). Through testing, we have found the most compatible way to format the message is to always have:
We always transform the input message into the above, creating parts as necessary. This ensures that all other manipulation of the message we perform doesn't result in rendering issues.
If I understand correctly, @adamcooke, you would like the following behaviour after this PR is implemented:
I'm discounting I hope this clears up what we're trying to achieve. |
This may be a naive question, however: Is this PR going to be merged? It appears to fix a bug in Postal, at least it fixes the attachment/body issue I brought up in #2236. Thanks for helping me understand the process. |
Merged, I now understand the problem and this appears to solve it! I do apologize for taking SO long to test and merge this. |
Was this really merged? I tried running postal upgrade to get the latest version and I got the same version I previously had which was 2.1.2 (which has this pressing issue). |
It was merged a couple of days ago. There hasn't yet been a release that contains it. |
Do you know when this fix will be released? It's pretty crucial to the work I'm doing atm. |
Any news on the release of this fix? |
No. The next release is awaiting the completion of #2392 which I need to test and merge. |
Resolves #375