When I enabled elastic email my ubercart emails were no sent with content text/html. Instead, they were set as text/plain and as a result html tags appeared in the email.

Comments

neilotoole’s picture

Assigned: Unassigned » neilotoole

Ezra, can you please give me the exact versions of drupal, ubercart, etc. that you're using?

ezra’s picture

Sorry for the delay, here is the info:

Drupal 6.20
MySQL database 5.1.50
PHP 5.2.6-1+lenny9
Ubercart 6.x-2.4

alexdav’s picture

Status: Active » Needs review
StatusFileSize
new913 bytes

Here's a small patch to allow the module to send out HTML emails when not specifically calling _elastic_email_send().

mike.davis’s picture

Assigned: neilotoole » mike.davis
Issue summary: View changes
mike.davis’s picture

StatusFileSize
new2.5 KB

Hi @alexdav,

Thanks for your patch. I have checked it and there was a bit missing for the change to the _elastic_email_send function for the html body. I have updated the patch to include this as well as updating the way in which you were checking if the email needed to be html or not. I have used a check on the $message['header'] variable to determine if the email was text/plain or not.

If you could review this and let me know if this works correctly or not, then we can get it to RBTC and committed.

  • mike.davis committed 9e78838 on 6.x-1.x
    Issue #1047810 by mike.davis, alexdav: fix for html email not working.
    
mike.davis’s picture

Version: 6.x-1.0 » 7.x-1.0
Status: Needs review » Patch (to be ported)

Patch committed, needs to be ported to 7.x-1.x branch now

mike.davis’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new5.75 KB

Here is the patch for Drupal 7 version. This also adds a test button to the admin interface to test the sending of HTML emails.

  • mike.davis committed 34b8f13 on 7.x-1.x
    Issue #1047810 by mike.davis: Fixed html email not working.
    
mike.davis’s picture

Status: Needs review » Fixed

This has been committed now

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Daemon_Byte’s picture

Version: 7.x-1.0 » 7.x-2.0-rc1
Status: Closed (fixed) » Active

This seems to be back for version 7.2.x

Daemon_Byte’s picture

I don't know why but changing

$s_html = (strpos($message['headers']['Content-Type'], 'text/plain') !== FALSE);

into 2 lines

$s_plain = strpos($message['headers']['Content-Type'], 'text/plain');
$s_html = ($s_plain === false);

fixed my problem. The top gave me false and the bottom gave me true.

mike.davis’s picture

Hi @Daemon_Byte, thanks for using the module.

It is strange that this would be different between the 1.x and the 2.x versions.

Have you tried it using the 7.x-1.0 version to see if this works fine on this version - i.e. is this specific to the 7.x-2.x version or have you only used the 2.x version?
Also what PHP version are you using?

Thanks
Mike

Daemon_Byte’s picture

PHP Version 5.4.43. I did try the v1 version and it didn't work either. As I said I managed to narrow it down to that line and now I look at it again I understand the logic fail. In the version used by the code it looks to see if it finds the text string and if it doesn't (as in my case) strpos returns false. You then set html to be true only if strpos doesn't return false. I flipped that logic and said html is true if strpos returns false.

mike.davis’s picture

Interesting. I see that nor only have you put the vide onto 2 lines but flipped the logic.

Have you tried the flipped logic when it is just in one line?

Also if you can provide a patch I'd be happy to check it out and get it committed.

Daemon_Byte’s picture

I would imagine it would work on one line with the logic switched. I can't test it today but I will find a bit of time tomorrow to do so then get a patch file created.

mike.davis’s picture

Status: Active » Needs review
StatusFileSize
new644 bytes

Hi @Daemon_Byte, I have finally had a chance to test this and this does seem to fix the issue.

Here is a patch for it.

mike.davis’s picture

Status: Needs review » Fixed

This has been committed now

  • mike.davis committed 31d649d on 7.x-2.x
    Issue #1047810 by mike.davis, alexdav: html email not working
    

  • mike.davis committed 7ff43a9 on 8.x-2.x
    Issue #1047810 by mike.davis: html email not working
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.