mailhog / MailHog

Web and API based SMTP testing
MIT License
13.81k stars 1.05k forks source link

html email rendering as plain text #22

Open adamaltman opened 9 years ago

adamaltman commented 9 years ago

When MailHog receives an email, which is html, it renders it as "plain text". I don't know why this happens, and how to render it as html.

Here is an example of part of the headers, as well as a screenshot:

Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=utf-8 

selection_218

ian-kent commented 9 years ago

Thanks @adamaltman, does this happen with all HTML messages or just occasionally?

I can sort of reproduce it, but only when the HTML email follows a plain text email. When it happens, the broken HTML message contains the previous plain text email at the start (and I assume the headers), which is why MIME parsing fails. I'll fix that anyway, but does it sound like it might be the same bug?

adamaltman commented 9 years ago

Right now it happens with all HTML messages.

ian-kent commented 9 years ago

Ok thanks, I'll have another look

Out of interest, do you know if the SMTP client is using pipelining?

adamaltman commented 9 years ago

Ian - I'm not sure. The client is a php web application. The library it uses for email is: http://swiftmailer.org/

ian-kent commented 9 years ago

No problem, thanks, I'll see if I can reproduce it a bit more consistently.

jygastaud commented 9 years ago

I have the same issue with a Drupal (PHP) website + PHPMailer library. Mails in (real) inbox as Gmail are display fine but MailHog seems not to understand it. Plain text with HTLML structure are displayed.

ian-kent commented 9 years ago

Would either of you be able to provide MailHog logs demonstrating the bug so I can replay the SMTP conversation against my MailHog to reproduce it?

If you don't want to post it here, if possible could you e-mail them to me instead? email@iankent.co.uk

Thanks

JanStevens commented 9 years ago

I have the same issue using a Rails application, i'm willing to provide logs if you guide me to their location or how to log them

Thanks for this awesome program, mailcatcher is sadly not really maintained and doesn't work for ruby 2.2.0 so this is a very good alternative!

ian-kent commented 9 years ago

Thanks @JanStevens, that would definitely be useful!

It'll depend on how you're running MailHog - if its from the command line, the logs should be going to STDOUT, so redirecting to file or piping to tee should work.

Let me know if its Docker and I'll give it a go, to be honest I hadn't even considered how logging would work for the Docker container builds (and I'm no Docker expert!!).

ian-kent commented 9 years ago

I'll keep this open for now, but I hope the latest release has fixed it - but couldn't reproduce it reliably anyway so not entirely sure.

jygastaud commented 9 years ago

Sadly, no. At least in my case.

MailHog version: 0.1.2 Linux amd64 OS: Debian 7

I will sent you a log file in a minute.

ian-kent commented 9 years ago

Think I've got it this time, but I'll keep the issue open for now

jygastaud commented 9 years ago

Great work Ian. Works for me in 0.1.3

JanStevens commented 9 years ago

Oke still doesnt work for me, I've send you an email with the output. If you need more information then please let me know! thanks!

ian-kent commented 9 years ago

Thanks @JanStevens, I'll have a look asap.

chuntley commented 9 years ago

I'm having this same issue. The headers look correct but the email is being rendered in plain text. Is there a way to force all emails to be rendered as HTML as a workaround?

4lyn commented 8 years ago

Same problem here. All my emails seen as plainText. It would be the perfect tool otherwise

ian-kent commented 8 years ago

Thanks for the updates @chuntley @4lyn - could you provide example SMTP messages plus the log output for MailHog receiving them.

4lyn commented 8 years ago

Simple php code :

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
$headers .= 'From: Test <noreply@test.fr>';
mail('test@test.fr', 'Test html email', '<html><body>This should be html email<br/>Thank you</body></html>', $headers)

I only see the "Plain text" and "Source" Tab in the MailHog web interface

MailHog log :

2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Starting session 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: INVALID] Started session, switching to ESTABLISH state 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Sent 35 bytes: '220 mailhog.example ESMTP MailHog\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Received 16 bytes: 'EHLO localhost\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: ESTABLISH] Processing line: EHLO localhost 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: ESTABLISH] In state 1, got command 'EHLO', args 'localhost' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: ESTABLISH] Got EHLO command, switching to MAIL state 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Sent 21 bytes: '250-Hello localhost\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Sent 16 bytes: '250-PIPELINING\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Sent 16 bytes: '250 AUTH PLAIN\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Received 28 bytes: 'MAIL FROM:www-data@ginza\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: MAIL] Processing line: MAIL FROM:www-data@ginza 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: MAIL] In state 6, got command 'MAIL', args 'FROM:www-data@ginza' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: MAIL] Got MAIL command, switching to RCPT state 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Sent 30 bytes: '250 Sender www-data@ginza ok\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Received 24 bytes: 'RCPT TO:test@test.fr\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: RCPT] Processing line: RCPT TO:test@test.fr 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: RCPT] In state 7, got command 'RCPT', args 'TO:test@test.fr' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: RCPT] Got RCPT command 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Sent 31 bytes: '250 Recipient test@test.fr ok\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Received 6 bytes: 'DATA\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: RCPT] Processing line: DATA 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: RCPT] In state 7, got command 'DATA', args '' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: RCPT] Got DATA command, switching to DATA state 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Sent 37 bytes: '354 End data with .\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Received 251 bytes: 'To: test@test.fr\r\nSubject: Test html email\r\nX-PHP-Originating-Script: 1000:functions.php\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=UTF-8\r\nFrom: Test noreply@test.fr\r\n\r\nThis should be html email
Thank you\r\n.\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: DATA] Got EOF, storing message and switching to MAIL state 2016/03/25 11:19:58 Parsing Content from string: 'To: test@test.fr Subject: Test html email X-PHP-Originating-Script: 1000:functions.php MIME-Version: 1.0 Content-type: text/html; charset=UTF-8 From: Test noreply@test.fr

This should be html email
Thank you' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Storing message IWU1gnlVnECkLLBj2hXoMRBD8ycJRYAnjMRiZFl9OrQ=@mailhog.example 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Sent 80 bytes: '250 Ok: queued as IWU1gnlVnECkLLBj2hXoMRBD8ycJRYAnjMRiZFl9OrQ=@mailhog.example\r\n' Got message in APIv1 event stream 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Received 6 bytes: 'QUIT\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: MAIL] Processing line: QUIT 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: MAIL] In state 6, got command 'QUIT', args '' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] [PROTO: MAIL] Got QUIT verb, staying in MAIL state 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Sent 9 bytes: '221 Bye\r\n' 2016/03/25 11:19:58 [SMTP 127.0.0.1:50089] Session ended Sending content: { "ID": "IWU1gnlVnECkLLBj2hXoMRBD8ycJRYAnjMRiZFl9OrQ=@mailhog.example", "From": { "Relays": null, "Mailbox": "www-data", "Domain": "ginza", "Params": "" }, "To": [ { "Relays": null, "Mailbox": "test", "Domain": "test.fr", "Params": "" } ], "Content": { "Headers": { "Content-type": [ "text/html; charset=UTF-8" ], "From": [ "Test \u003cnoreply@test.fr\u003e" ], "MIME-Version": [ "1.0" ], "Message-ID": [ "IWU1gnlVnECkLLBj2hXoMRBD8ycJRYAnjMRiZFl9OrQ=@mailhog.example" ], "Received": [ "from localhost by mailhog.example (Go-MailHog)\r\n id IWU1gnlVnECkLLBj2hXoMRBD8ycJRYAnjMRiZFl9OrQ=@mailhog.example; Fri, 25 Mar 2016 11:19:58 +0100" ], "Return-Path": [ "\u003cwww-data@ginza\u003e" ], "Subject": [ "Test html email" ], "To": [ "test@test.fr" ], "X-PHP-Originating-Script": [ "1000:functions.php" ] }, "Body": "\u003chtml\u003e\u003cbody\u003eThis should be html email\u003cbr/\u003eThank you\u003c/body\u003e\u003c/html\u003e", "Size": 246, "MIME": null }, "Created": "2016-03-25T11:19:58.484317981+01:00", "MIME": null, "Raw": { "From": "www-data@ginza", "To": [ "test@test.fr" ], "Data": "To: test@test.fr\r\nSubject: Test html email\r\nX-PHP-Originating-Script: 1000:functions.php\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=UTF-8\r\nFrom: Test \u003cnoreply@test.fr\u003e\r\n\r\n\u003chtml\u003e\u003cbody\u003eThis should be html email\u003cbr/\u003eThank you\u003c/body\u003e\u003c/html\u003e", "Helo": "localhost" } }
hugochinchilla commented 8 years ago

+1 Happens for me too

crazy-max commented 8 years ago

+1 For me too with the basic example from PHP website Example #4 Sending HTML email.

mail

akreal commented 8 years ago

I think the problem is that some messages have Content-type header, while MailHog checks only Content-Type one: https://github.com/mailhog/MailHog-UI/blob/master/assets/js/controllers.js#L461

4lyn commented 8 years ago

Nice shot ! It works for me now. Thanks a lot !

crazy-max commented 8 years ago

Maybe we can add an other control over the content (html tags) if the Content-type is blank ?

jehon commented 7 years ago

I have the same problem with a Drupal installation sending emails.

Looking a bit in the Drupal system, I see that it send content-type with a lower "t".

Is it possible to fix this?

nortmas commented 7 years ago

I think the problem is that some messages have Content-type header, while MailHog checks only Content-Type one: https://github.com/mailhog/MailHog-UI/blob/master/assets/js/controllers.js#L458

Guys, it's still not fixed. Can anyone fix this please?

nortmas commented 7 years ago

How to find controllers.js locally (Ubuntu)? Can't find it. Could someone help me please?

jehon commented 7 years ago

Still interested in a fix of this one...

How could I help?

nortmas commented 7 years ago

Can you fix this line - https://github.com/mailhog/MailHog-UI/blob/master/assets/js/controllers.js#L458

Instead of this: if (message.Content.Headers && message.Content.Headers["Content-Type"] && message.Content.Headers["Content-Type"][0].match("text/plain")) {

need to use something like this:

if ( message.Content.Headers && ( (message.Content.Headers["Content-Type"] && message.Content.Headers["Content-Type"][0].match("text/plain")) || (message.Content.Headers["Content-type"] && message.Content.Headers["Content-type"][0].match("text/plain")) ) ) {

Because some messages have "Content-type" header, while MailHog checks only "Content-Type"

Also I can't find controllers.js locally (Ubuntu) to fix this file. Do you know the location where I should search?

ian-kent commented 7 years ago

Sorry, thought I'd fixed this... https://github.com/mailhog/MailHog/issues/113 turns out it was a different bug!

controllers.js is inside MailHog-UI - https://github.com/mailhog/MailHog-UI/blob/master/assets/js/controllers.js

there's a bunch of places where it treats headers incorrectly - more than happy to accept a PR to fix this one, but otherwise I'll have a look at cleaning that mess up asap!

edit: afaik, to be RFC compliant in its header handling it can just lowercase everything before the comparison/lookup (I think it was defined in RFC822, but seems to be missing from the updated RFC2822 and RFC5322 - if anyone knows where its now covered it'd be a great help!)

timmetj commented 7 years ago

Any news on this? Also seeing everything in plain-text

Barry-Fisher commented 7 years ago

I'm finding that HTML tab doesn't display on version 0.2.1-4 - only the Plain text and Source tabs. The email body looks like:

This is a multi-part message in MIME format.

--57201bf7ced0e78fd2e77e80d390449b59d746de9 Content-Type:multipart/alternative; boundary="99569b95c2565c7786d9de5a6b102e5715176f928" Content-Transfer-Encoding:8bit

--99569b95c2565c7786d9de5a6b102e5715176f928 Content-Type:text/plain; charset=utf-8 Content-Disposition:inline Content-Transfer-Encoding:8bit

CLIPPED MESSAGE

--99569b95c2565c7786d9de5a6b102e5715176f928 Content-Type:text/html; charset=utf-8 Content-Disposition:inline Content-Transfer-Encoding:8Bit

CLIPPED MESSAGE

--99569b95c2565c7786d9de5a6b102e5715176f928--

--57201bf7ced0e78fd2e77e80d390449b59d746de9--

The Content-Type header appears to have the right case to match the javascript. I'm also using Drupal and the PHPMailer library.

Does anything appear glaringly obvious that I'm missing here?

FellowshipAgency commented 6 years ago

I'm also seeing HTML emails in plain text.

vukomir commented 6 years ago

I have the same problem with HTML emails.

hellerbenjamin commented 5 years ago

Experiencing this consistently today with a Woocommerce site. If I have time I will help troubleshoot but does anyone want logs if I supply them?

webdobe commented 5 years ago

I am getting this as well with a Drupal 8 docker install. Regardless if I send in html or not. Been debugging, but not getting anywhere. I changed some info to remain anonymous, I see the mailhog.example.. not sure If that is causing the issue?

2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Starting session
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: INVALID] Started session, switching to ESTABLISH state
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Sent 35 bytes: '220 mailhog.example ESMTP MailHog\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Received 19 bytes: 'EHLO cbd2025bd2d3\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: ESTABLISH] Processing line: EHLO cbd2025bd2d3
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: ESTABLISH] In state 1, got command 'EHLO', args 'cbd2025bd2d3'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: ESTABLISH] In ESTABLISH state
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: ESTABLISH] Got EHLO command, switching to MAIL state
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Sent 24 bytes: '250-Hello cbd2025bd2d3\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Sent 16 bytes: '250-PIPELINING\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Sent 16 bytes: '250 AUTH PLAIN\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Received 40 bytes: 'MAIL FROM:<noreply@XXX.com>\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: MAIL] Processing line: MAIL FROM:<noreply@XXX.com>
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: MAIL] In state 6, got command 'MAIL', args 'FROM:<noreply@XXX.com>'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: MAIL] In MAIL state
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: MAIL] Got MAIL command, switching to RCPT state
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Sent 42 bytes: '250 Sender noreply@XXX.com ok\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Received 25 bytes: 'RCPT TO:<jesse@XXX.com>\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: RCPT] Processing line: RCPT TO:<jesse@XXX.com>
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: RCPT] In state 7, got command 'RCPT', args 'TO:<jesse@XXX.com>'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: RCPT] In RCPT state
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: RCPT] Got RCPT command
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Sent 32 bytes: '250 Recipient jesse@XXX.com ok\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Received 6 bytes: 'DATA\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: RCPT] Processing line: DATA
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: RCPT] In state 7, got command 'DATA', args ''
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: RCPT] In RCPT state
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: RCPT] Got DATA command, switching to DATA state
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Sent 37 bytes: '354 End data with <CR><LF>.<CR><LF>\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Received 939 bytes: 'To: jesse@XXX.com\r\nSubject: An administrator created an account for you at My Website\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes\r\nContent-Transfer-Encoding: 8Bit\r\nX-Mailer: Drupal\r\nSender: noreply@XXX.com\r\nFrom: My Website <noreply@XXX.com>\r\nReply-to: noreply@XXX.com\r\n\r\ntest,\r\n\r\nA site administrator at My Website has created an account for you. You\r\nmay now log in by clicking this link or copying and pasting it to your\r\nbrowser:\r\n\r\nhttps://www.XXX.com/user/reset/31/1554073132/v1aMTWcBUVq33Y1u5mI53zGayTlmDKk0ghT7XXQlGpk\r\n\r\nThis link can only be used once to log in and will lead you to a page where\r\nyou can set your password.\r\n\r\nAfter setting your password, you will be able to log in at\r\nhttps://www.XXX.com/user in the future using:\r\n\r\nusername: test\r\npassword: Your password\r\n\r\n--  My Website team\r\n\r\n.\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: DATA] Got EOF, storing message and switching to MAIL state
2019/03/31 22:58:53 Parsing Content from string: 'To: jesse@XXX.com

Subject: An administrator created an account for you at My Website

MIME-Version: 1.0

Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes

Content-Transfer-Encoding: 8Bit

X-Mailer: Drupal

Sender: noreply@XXX.com

From: My Website <noreply@XXX.com>

Reply-to: noreply@XXX.com

test,

A site administrator at My Website has created an account for you. You

may now log in by clicking this link or copying and pasting it to your


https://www.XXX.com/user/reset/31/1554073132/v1aMTWcBUVq33Y1u5mI53zGayTlmDKk0ghT7XXQlGpk

This link can only be used once to log in and will lead you to a page where

you can set your password.

After setting your password, you will be able to log in at

https://www.XXX.com/user in the future using:

username: test

password: Your password

--  My Website team

'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Storing message Or9hsMg92pBJ2WF0V2VjPsTELraP4xQH3lhj5K_iyN0=@mailhog.example
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Sent 80 bytes: '250 Ok: queued as Or9hsMg92pBJ2WF0V2VjPsTELraP4xQH3lhj5K_iyN0=@mailhog.example\r\n'
Got message in APIv2 websocket channel
[APIv2] BROADCAST /api/v2/websocket
Got message in APIv1 event stream
Sending content: {
  "ID": "Or9hsMg92pBJ2WF0V2VjPsTELraP4xQH3lhj5K_iyN0=@mailhog.example",
  "From": {
    "Relays": null,
    "Mailbox": "noreply",
    "Domain": "XXX.com",
    "Params": ""
  },

[
    {
      "Relays": null,
      "Mailbox": "jesse",
      "Domain": "XXX.com",
      "Params": ""
    }
  ],
  "Content": {
    "Headers": {
      "Content-Transfer-Encoding": [
        "8Bit"
      ],
      "Content-Type": [
        "text/plain; charset=UTF-8; format=flowed; delsp=yes"
      ],
      "From": [
        "My Website \u003cnoreply@XXX.com\u003e"
      ],
      "MIME-Version": [
        "1.0"
      ],
      "Message-ID": [
        "Or9hsMg92pBJ2WF0V2VjPsTELraP4xQH3lhj5K_iyN0=@mailhog.example"
      ],
      "Received": [
        "from cbd2025bd2d3 by mailhog.example (MailHog)\r\n          id Or9hsMg92pBJ2WF0V2VjPsTELraP4xQH3lhj5K_iyN0=@mailhog.example; Sun, 31 Mar 2019 22:58:53 +0000"
      ],
      "Reply-to": [
        "noreply@XXX.com"
      ],
      "Return-Path": [
        "\u003cnoreply@XXX.com\u003e"
      ],
      "Sender": [
        "noreply@XXX.com"
      ],
      "Subject": [
        "An administrator created an account for you at My Website"
      ],
      "To": [
        "jesse@XXX.com"
      ],
      "X-Mailer": [
        "Drupal"
      ]
    },
    "Body": "test,\r\n\r\nA site administrator at My Website has created an account for you. You\r\nmay now log in by clicking this link or copying and pasting it to your\r\nbrowser:\r\n\r\nhttps://www.XXX.com/user/reset/31/1554073132/v1aMTWcBUVq33Y1u5mI53zGayTlmDKk0ghT7XXQlGpk\r\n\r\nThis link can only be used once to log in and will lead you to a page where\r\nyou can set your password.\r\n\r\nAfter setting your password, you will be able to log in at\r\nhttps://www.XXX.com/user in the future using:\r\n\r\nusername: test\r\npassword: Your password\r\n\r\n--  My Website team\r\n",
    "Size": 934,
    "MIME": null
  },
  "Created": "2019-03-31T22:58:53.606873215Z",
  "MIME": null,
  "Raw": {
    "From": "noreply@XXX.com",
    "To": [
      "jesse@XXX.com"
    ],
    "Data": "To: jesse@XXX.com\r\nSubject: An administrator created an account for you at My Website\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes\r\nContent-Transfer-Encoding: 8Bit\r\nX-Mailer: Drupal\r\nSender: noreply@XXX.com\r\nFrom: My Website \u003cnoreply@XXX.com\u003e\r\nReply-to: noreply@XXX.com\r\n\r\ntest,\r\n\r\nA site administrator at My Website has created an account for you. You\r\nmay now log in by clicking this link or copying and pasting it to your\r\nbrowser:\r\n\r\nhttps://www.XXX.com/user/reset/31/1554073132/v1aMTWcBUVq33Y1u5mI53zGayTlmDKk0ghT7XXQlGpk\r\n\r\nThis link can only be used once to log in and will lead you to a page where\r\nyou can set your password.\r\n\r\nAfter setting your password, you will be able to log in at\r\nhttps://www.XXX.com/user in the future using:\r\n\r\nusername: test\r\npassword: Your password\r\n\r\n--  My Website team\r\n",
    "Helo": "cbd2025bd2d3"
  }
}

[APIv1] BROADCAST /api/v1/events
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Received 6 bytes: 'QUIT\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: MAIL] Processing line: QUIT
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: MAIL] In state 6, got command 'QUIT', args ''
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] [PROTO: MAIL] Got QUIT verb, staying in MAIL state
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Sent 9 bytes: '221 Bye\r\n'
2019/03/31 22:58:53 [SMTP 172.18.0.36:51742] Session ended
KoolPal commented 5 years ago

Oh man! I installed MailHog just to work on Woocommerce emails and now I find this issue! 😭

hellerbenjamin commented 5 years ago

Oh man! I installed MailHog just to work on Woocommerce emails and now I find this issue! '

This might help in the meantime https://wordpress.org/plugins/woo-preview-emails/

KoolPal commented 5 years ago

Oh man! I installed MailHog just to work on Woocommerce emails and now I find this issue! '

This might help in the meantime https://wordpress.org/plugins/woo-preview-emails/

@hellerbenjamin Thanks I will use this.

e-belair commented 4 years ago

Hi, I'm facing similar issue as the mail body is shown encoded. I'm using mailer lib from dart image image

smustgrave commented 3 years ago

I'm also experiencing this issue in Drupal if anyone has any suggestions. I'm using https://www.drupal.org/project/swiftmailer to send HTML emails but no luck.
Headers being generated

Content-Transfer-Encoding 8Bit

text/plain; charset=UTF-8; format=flowed; delsp=yes NASA Drupal Demo admin@example.com 1.0 jkNuxytJS1Phvb8xbtIOtuJ50vNV6xXZ7MPBWZLGO0A=@email.mailhog.lando from localhost by email.mailhog.lando (MailHog) id jkNuxytJS1Phvb8xbtIOtuJ50vNV6xXZ7MPBWZLGO0A=@email.mailhog.lando; Thu, 21 Jan 2021 02:31:12 +0000 admin@example.com admin@example.com Article: Test updated something@test.com Drupal

3pdev-alex commented 3 years ago

Using MailHog with plain PHP and having the same issue. Using Content-Type: text/html;charset=utf-8 and all emails are coming in as plain text instead of HTML.

vandijkstef commented 3 years ago

Having the same issue also using UTF-8. Interesting; The 'MIME' tab shows and it shows each part as 'unknown'. When downloading the email as EML file, and opening it in apple mail, it renders as expected.

I'd love to drop a mailhog version, but 'mailhog --version' doesn't give a number, its blank.

nkboscia commented 3 years ago

Same issue. Using multi-type emails and it doesn't display the HTML tab at all and the MIME type just gives an error: Error: null is not an object (evaluating 'data.MIME.Parts.length')

Content-Type: multipart/alternative; boundary="1623876169.D35aAB6D0.32925"; charset="us-ascii" MIME-Version: 1.0

MIME-Version: 1.0 Content-Type: text/html; charset="UTF-8"

MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"

nkboscia commented 3 years ago

I put a paid bounty on this in hopes it'll get bumped in priority.

https://www.bountysource.com/issues/7463217-html-email-rendering-as-plain-text

tecbird commented 3 years ago

try to prepand body an "\r\n". in my case mailhog is now extracting data correct from message source....

nkboscia commented 2 years ago

The mail receive identifies to parse on the boundary just fine, but the web interface just throws everything into the plain text tab and ignores the boundary and Content-Type headers.

leymannx commented 2 years ago

Colleague of mine had the problem with Swiftmailer/Drupal. When they changed the "Sender" to use the "Default PHP Mailer" and keep just the "Formatter" using "Swiftmailer" it suddenly worked.

2022-02-11 at 12 07

stefumies commented 2 years ago

This is still an issue in Summer 2022, I cant see how this will allow us to continue with Mailhog. Any updates? I have the issue from nodemailer

michaeljauk commented 1 year ago

Also having the same issue with nodemailer: ^6.7.8