Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is ActionMailer randomly not displaying the plain text part of my multipart/alternative emails?
    text
    copied!<p>I'm trying to send emails that have both a plain text and html component. There are no attachments, but there are inline images in the HTML part. I'm using the content-type "multipart/alternative". I'm not explicitly setting the parts; I'm relying on the filenames to determine the parts. I'm on rails 2.3.10.</p> <p>Approximately 60% of the time, the emails that are sent come through with no body, and the HTML part is attached to the message with the name "noname" (in gmail anyway). The rest of the time they send as expected. If I send out 10 emails in 10 seconds, almost always 6 of them will be blank.</p> <p>When I inspect the logs, the messages that come through correctly show both mime parts in the log and show a boundary value in the content-type declaration. </p> <p>The blank emails still have a content-type of multipart/alternative, but no boundary, because the blank emails do not render the plain text part, and only show the html part. Looking at the templates being rendered, it's clear that the plain text part of the message is completely skipped. </p> <p>Why does this sometimes work and often fail? The messages are all being sent with a delayed job. </p> <p>Log for a "good" email:</p> <blockquote> <p>Rendered notifications/_comment (0.1ms)<br> Rendered layouts/_footer (2.1ms)<br> Rendered layouts/_container (2.3ms)<br> Rendered shared/attachments/_count (0.6ms)<br> Rendered layouts/speech/_bubble (21.4ms)<br> Rendered layouts/speech/_detail (0.8ms)<br> Rendered notifications/_comment (22.6ms)<br> Rendered layouts/_footer (2.0ms)<br> Rendered layouts/_container (2.2ms)<br> Sent mail to [redacted]</p> <p>Date: Mon, 8 Nov 2010 11:37:24 -0800<br> From: "[redacted]" &lt;[redacted]><br> Reply-To: "[redacted]" [redacted]<br> To: [redacted]<br> Subject: Someone commented on your thing<br> Mime-Version: 1.0<br> Content-Type: multipart/alternative; boundary=mimepart_4cd85174328d6_1486..fdbe5b8d87fe</p> <p>--mimepart_4cd85174328d6_1486..fdbe5b8d87fe<br> Content-Type: text/plain; charset=utf-8<br> Content-Transfer-Encoding: Quoted-printable<br> Content-Disposition: inline </p> <p>[the content of the plain text part]</p> <hr> <p>[the content of the html part]<br> --mimepart_4cd85174328d6_1486..fdbe5b8d87fe--</p> </blockquote> <p>Log for the blank email:</p> <blockquote> <p>Rendered shared/attachments/_count (0.1ms)<br> Rendered layouts/speech/_bubble (0.6ms)<br> Rendered layouts/speech/_detail (0.7ms)<br> Rendered notifications/_comment (1.6ms)<br> Rendered layouts/_footer (25.9ms)<br> Rendered layouts/_container (26.1ms)<br> Sent mail to [redacted]</p> <p>Date: Mon, 8 Nov 2010 11:37:29 -0800<br> From: "[redacted]" &lt;[redacted]><br> Reply-To: "[redacted]" &lt;[redacted]><br> To: [redacted]<br> Subject: Someone commented on your thing<br> Mime-Version: 1.0<br> Content-Type: multipart/alternative; charset=utf-8 </p> <p>[the content of the HTML part]</p> </blockquote> <p>Note that those emails were sent 5 seconds apart, and both emails (were supposed to) contain the same thing.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload