PHP Classes

Roundcube Webmail client problem

Recommend this page to a friend!

      MIME E-mail message sending  >  MIME E-mail message sending package blog  >  How Can PHP Send Emai...  >  All threads  >  Roundcube Webmail client problem  >  (Un) Subscribe thread alerts  
Subject:Roundcube Webmail client problem
Summary:This is an HTML message. Please use an HTML capable mail program
Messages:4
Author:Said Bakr
Date:2008-04-26 22:30:25
Update:2008-05-01 17:53:11
 

  1. Roundcube Webmail client problem   Reply   Report abuse  
Picture of Said Bakr Said Bakr - 2008-04-26 22:30:26
Hi,
I installed Roundcube webmail client on my website. I have set its setting to be able to display HTML messages. I have sending email script that depends on email_message class. The problem is that message "This is an HTML message. Please use an HTML capable mail program to read this message." appeares instead of the original HTML message.

My email account that uses Roundcube can receive fine any other HTML email message.

Another notice, When I sending email message using my script regarded above to my mail on Yhaoo, it looks fine, but when I try to forward that mail to my gmail account that I use Outlook Express as mail client, the regarded message is appeared too.

Best Regards.
Said Bakr

  2. Re: Roundcube Webmail client problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-04-27 01:37:10 - In reply to message 1 from Said Bakr
It seems there is no problem with the MIME message class itself.

From your description it seems that when the messages pass in a certain mail server gateway, the HTML part is removed, so you only see the default plain text part, which is what non-HTML capable programs can display.

You may want to test sending a new HTML message with the class that does not have any links or images. If you can see HTML message this way, there may be a filter in your mail system that discards HTML parts based on content.

Another thing you may want to try is ask your mail client program to show the filtered message source. If there was any filtering, chances are that the filtering program added some explanatory comments in the headers.

  3. Re: Roundcube Webmail client problem   Reply   Report abuse  
Picture of Said Bakr Said Bakr - 2008-05-01 00:54:43 - In reply to message 2 from Manuel Lemos
Hello,

I just modified the example enclosed with the package as follows:
The $content is an output of patTemplate object. Temporarly, to overcome this situiation, I concatenate $text_message="This is an HTML message.strip_tags($content);

I'd liked to submit the code inorder to chance catch any misatke.


<?php
function sendMail($from_name, $from_address, $to_name, $to_address, $subject, $content){
/*
* test_html_mail_message.php
*
* @(#) $Header: /home/mlemos/cvsroot/mimemessage/test_html_mail_message.php,v 1.11 2003/10/30 21:36:12 mlemos Exp $
*
*/

//require("mail2/smtp.php");
//require("mail2/sasl/sasl.php");
require("mail2/email_message.php");
//require("mail2/smtp_message.php");

// require("sasl/sasl.php");



/*
* Trying to guess your e-mail address.
* It is better that you change this line to your address explicitly.
* $from_address="me@mydomain.com";
* $from_name="My Name";
*/
$from_address="info@azzazianesthesia.com";
$from_name="Azzazi Anesthesia";

$reply_name=$from_name;
$reply_address=$from_address;
$reply_address=$from_address;
$error_delivery_name=$from_name;
$error_delivery_address=$from_address;




/*
* Change these lines or else you will be mailing the class author.
*/
/* $to_name="Manuel Lemos";
$to_address="mlemos@acm.org";

$subject="Testing Manuel Lemos' MIME E-mail composing and sending PHP class: HTML message"; */
$email_message=new email_message_class;
$email_message->SetEncodedEmailHeader("To",$to_address,$to_name);
$email_message->SetEncodedEmailHeader("From",$from_address,$from_name);
$email_message->SetEncodedEmailHeader("Reply-To",$reply_address,$reply_name);
$email_message->SetHeader("Sender",$from_address);
if($email_message->smtp_direct_delivery)
{
if(!function_exists("GetMXRR"))
{

/* If possible specify in this array the address of at least on local
* DNS that may be queried from your network.
*/
$_NAMESERVERS=array();
include("getmxrr.php");
}

}




/*
* Set the Return-Path header to define the envelope sender address to which bounced messages are delivered.
* If you are using Windows, you need to use the smtp_message_class to set the return-path address.
*/
if(defined("PHP_OS")
&& strcmp(substr(PHP_OS,0,3),"WIN"))
$email_message->SetHeader("Return-Path",$error_delivery_address);

$email_message->SetEncodedHeader("Subject",$subject);


$html_message= $content;

$email_message->CreateQuotedPrintableHTMLPart($html_message,"",$html_part);

/*
* The complete HTML parts are gathered in a single multipart/related part.
*/
$related_parts=array(
$html_part

);
$email_message->CreateRelatedMultipart($related_parts,$html_parts);

/*
* It is strongly recommended that when you send HTML messages,
* also provide an alternative text version of HTML page,
* even if it is just to say that the message is in HTML,
* because more and more people tend to delete HTML only
* messages assuming that HTML messages are spam.
*/
$text_message="This is an HTML message. Please use an HTML capable mail program to read this message. However, you may able get message content below\n".strip_tags($content);
$email_message->CreateQuotedPrintableTextPart($email_message->WrapText($text_message),"",$text_part);

/*
* Multiple alternative parts are gathered in multipart/alternative parts.
* It is important that the fanciest part, in this case the HTML part,
* is specified as the last part because that is the way that HTML capable
* mail programs will show that part and not the text version part.
*/
$alternative_parts=array(
$text_part,
$html_parts
);
$email_message->AddAlternativeMultipart($alternative_parts);



/*
* The message is now ready to be assembled and sent.
* Notice that most of the functions used before this point may fail due to
* programming errors in your script. You may safely ignore any errors until
* the message is sent to not bloat your scripts with too much error checking.
*/
$error = $email_message->Send();
if(strcmp($error,""))
return false; //echo "Error: $error\n";
else
return true; //echo "Message sent to $to_name\n"; */

}
?>

  4. Re: Roundcube Webmail client problem   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-05-01 17:53:11 - In reply to message 3 from Said Bakr
I don't think there is anything wrong with your code. As you said, the message arrives correctly in some mail systems, but not in others. It seems there is a problem with those others unrelated with this class.

I talked with another user that was having a similar problem that was making him only see the text part of HTML newsletters sent by the PHPClasses site. Later he realized that was caused by a problem on his mail server. I could not understand what was that problem but it maybe something due to a recent change in your mail system. Ask your system administrator.