Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vpsaravanan created an issue. See original summary.

vpsaravanan’s picture

Issue summary: View changes
vpsaravanan’s picture

Version: 8.x-1.0-alpha2 » 8.x-1.0-alpha1
arunkumark’s picture

In Need to change the header of mails as text/html.

I have created a patch thats works for me.

Nagarajan Kumar’s picture

Status: Needs review » Needs work

Hi,
The patch #4 not working.

arunkumark’s picture

Hi,
I have made changes on patch and added headers in hook_mail_alter() function.

arunkumark’s picture

Status: Needs work » Needs review
pazhyn’s picture

There is a module for that - https://www.drupal.org/project/mimemail
Do we need to implement this in SMTP module?

maniosullivan’s picture

NancyDru’s picture

Does this need to be backported to 7.x?

estoyausente’s picture

I think that is not a SMTP use case as @pazhyn say... but maintainers should decide.

NancyDru’s picture

I am using MimeMail and it works fine with sending directly, but using SMTP to send through SendGrid is producing garbage.

estoyausente’s picture

Right now I'm using SMTP with mimemail and I'm sending HTML mails, but I don't remember if I had to did something special :-(

kevster’s picture

Im having the same issue in version 7 - soon as I turn on the SMTP module I get markup printed out and no matter what I do with formats, overriding templates I cant sort it...

Also using commerce mail, HTMLMail

<div class="view view-abandoned-cart-summary view-id-abandoned_cart_summary view-display-id-default view-dom-id-f76d8be839e66cb419dac3e7f943e0ca">
  
      <div class="view-content">
        <div>
      
  <div>        1 x Battery PC1A / LR50 - CB0132  </div>  </div>
    </div>
  
</div>
NancyDru’s picture

This was very helpful to me: https://www.drupal.org/node/1200142

nkoporec’s picture

Version: 8.x-1.0-alpha1 » 8.x-1.x-dev

Tested the patch from @maniosullivan and It's working perfectly, hope it gets committed soon since this is an important feature.

tepelena’s picture

Having the same problem. Can we get this committed, please?

lor’s picture

Hi, I have the same problem too and the patch #9 didn't solve my problem.

My config:

Formatter
Mime Mail mailer

Sender
SMTP Mailer

Theme to render the emails
Current

Could you fix it please?

Many thanks!

wundo’s picture

Status: Needs review » Needs work

Per the comments above, this needs work.

bkosborne’s picture

As others have already said, I think this is NOT a feature the SMTP module should implement. The SMTP module should only be about transmitting the email that's given to it.

This setting in the UI is strange and confusingly worded. When that checkbox is DISABLED, this module actually strips out all HTML from emails that are sent. I have no idea why this feature exists, but I recommend that it simply be removed entirely. If it's kept, the wording should be updated to something like "Strip HTML from emails" and perform the opposite action it currently does. When checked, THEN it should remove the HTML from emails. The way it's currently worded implies that this module is actually adding the text/html mimetype header to emails, and it is not doing that.

Chris Matthews’s picture

Status: Needs work » Needs review
FileSize
690 bytes

In response to #20, how about this patch?

wundo’s picture

Status: Needs review » Postponed (maintainer needs more info)

With the latest dev I've encountered no problems sending HTML emails, can anyone confirm this is still happening?

And if so, could you please share how you're reproducing it (with which modules for instance)?

AmiOta’s picture

@wundo I can confirm that works.

I removed the module from disk and manually uncompressed the latest version and finally works.

KlemenDEV’s picture

In my case, the mail is sent via mail() and not SMTP mailer, although all other modules respect Mail System and use SMTP mailer to send email.

luli_schnauzer’s picture

My mails are not working with html only when I add attachments, they work perfectly fine otherwise. The reason I found is in SMTPMailSystem.php, line 552:


          // If text/html within the body part, add it to $mailer->Body.
          elseif (strpos($body_part, 'text/html')) {
            // Clean up the text.
            $body_part = trim($this->removeHeaders(trim($body_part)));
            // Include it as part of the mail object.
            $mailer->Body = $body_part;
            $mailer->IsHTML(TRUE);
            $mailer->ContentType = 'multipart/mixed';

When my message is of type 'multipart/mixed' (because of using attachments), the type of the body will be set as 'multipart/mixed' too and won't interpret html.
The tweak I made to solve it was to comment the last line and instead put

   $mailer->ContentType = 'text/html';

When I do that, attachments still work and the body of the mail will interpret HTML.
Is this a bug, or is there something I might be doing wrong?

luli_schnauzer’s picture

My bad, I had installed email_attachment module that was setting the mime-type to multipart/mixed, but this interferes with this module.
Uninstalling it did the work.

SourabhBhalerao’s picture

I also tried checkbox but email is coming with html tags and it is not working.