• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

HTML in Emails

R

RavSS

Guest
All in plesk seems to working fine..except for email from php.

The scipt remains untouched and worked fine on another plesk box, now for some reason all HTML is shown in the email and webmail shows the mail as an attatchment.

Cant find any settings for this in plesk.
 
Very odd.. even a full reinstall will not resolve this issue..

Mails from webmail work fine.. but from php they dont.. plesk tech support have test the script we use and it works fine for them..

any help would be great.
 
Turns out that \r in the script caused all the problems ... very annoying.
 
/home/httpd/vhosts/webmail/horde/imp/config/mime_drivers.php

$mime_drivers['imp']['html']['inline'] = false; to true
 
Originally posted by RavSS
Turns out that \r in the script caused all the problems ... very annoying.
same problem here, so what to do with the \r ?
 
i already figured that one out ;)

but thanks anyway, it works for me here
 
I am having a similar problem...

When using IMP webmail, all HTML emails display the entire HTML code in the body of the email, instead of rendering it.

I enabled inline HTML in mime_drivers.php, but still no resolve. What script are talking about with the /r in it?

Does any body knowwhat could be happening?

Thanks.
 
I am experiencing the same problem as RavSS. It appears there is a misconfiguration with PHP and the mail server in the latest Plesk update - 7.5.3. As RavSS states, this is a new problem. PHP/HTML email worked fine in prior Plesk releases. Using the \r in PHP email headers is standard practice (please see the php manual - http://us3.php.net/manual/en/function.mail.php). Removing \r could cause problems if the script is used on a properly configured server or if Plesk fixes this issue in the future.

I have not yet tried the $mime_drivers update that Pagemakers suggests but by cvgeldern's post it does not seem to be a root solution. Has anyone else found a fix for this issue?

Sample PHP/HTML email script that *should* work but doesn't:

PHP:
<?php
   $to = "You <[email protected]>";
   $from = "Us <[email protected]>";
   $subject = "HTML E-mail test";
   $message="<h1>HTML E-mail</h1>";
   $headers = 'MIME-Version: 1.0' . "\r\n";
   $headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
   $headers.= "From: $from" . "\r\n";
   if (mail($to, $subject, $message, $headers))
      echo "Message Sent!";
   else
      echo "Failed to send message.";
?>
 
so any email that is sent with mail() via php does not send? or am i not understanding what is the problem...

no error messages?
 
Originally posted by serial-thrilla
so any email that is sent with mail() via php does not send? or am i not understanding what is the problem...

no error messages?

Mail sent via PHP mail() is sent without error but comes through as plain text. All headers are ignored and appear in the body of the email along with the raw HTML code.
 
oh, and you are setting "Content-type: text/html\r\n" ?
 
Originally posted by serial-thrilla
oh, and you are setting "Content-type: text/html\r\n" ?

Yes. (Sorry, my prior post did not reflect the correct code. Please see revised PHP code above. Thanks!)
 
we made a chage to:

/etc/psa-horde/imp/mime_drivers.php

$mime_drivers['imp']['html']['inline'] = false; to true

per Pagemakers post. It now works in Hotmail...but not Outlook or Gmail...so there continues to be a misconfiguration somewhere. (I assume Hotmail looks for HTML coding or is forgiving with misformatted headers, etc.) Very strange. The above PHP syntax is correct per the PHP manual and works on our other servers and hosted accounts. Any other suggestions?
 
just a random shot, but does the php.ini have "sendmail_path = /usr/sbin/sendmail -t -i" ?
 
php sendmail changed

We have the same problem overhere. All mailscripts that used to work before are not working anymore. Is there a global setting we can do? My php.ini is still showing

sendmail_path = /usr/sbin/sendmail -t -i

So that is still correct.

Changing the various scripts is not an option, we have over 300 domains on this server.
 
I don't believe we ever found a solution. I will be interested to know what you find out.
 
For us removing the \r from any variable in the mailscripts did work perfectly.

So subject, header etc. should be verified for having \r for end of lines.
 
agree that removing /r lines works, but it's a workaround. r/ lines are legal in php and worked in past plesk releases. this is a bug introduced in the latest plesk release and one swsoft needs to address.
 
Back
Top