#6475: Email component ignores sendAs attribute when there are attachments
-------------------------------------------+--------------------------------
    Reporter:  matsinet                    |          Type:  Bug       
      Status:  new                         |      Priority:  Medium    
   Milestone:  1.2.x.x                     |     Component:  Components
     Version:  1.2 Final                   |      Severity:  Normal    
    Keywords:  email component attachment  |   Php_version:  n/a       
Cake_version:  1.2.2.8120                  |  
-------------------------------------------+--------------------------------
 When sending an email html formatted, the email component ignores the
 sendAs attribute and the body of the message is formatted as text/plain
 instead of text/html.[[BR]]
 [[BR]]
 The issue lies in the !__formatMessage function as it does not check for
 the sendAs attribute value.[[BR]]
 [[BR]]
 = Current !__formatMessage function =
 {{{
 function __formatMessage($message) {
         if (!empty($this->attachments)) {
                 $prefix = array(
                         '--' . $this->__boundary,
                         'Content-Type: text/plain; charset=' .
 $this->charset,
                         'Content-Transfer-Encoding: 7bit',
                         ''
                 );
                 $message = array_merge($prefix, $message);
         }
         return $message;
 }
 }}}
 = Modified !__formatMessage function =
 {{{
 function __formatMessage($message) {
         if (!empty($this->attachments)) {
                 $prefix[] = '--' . $this->__boundary;
                 if ($this->sendAs === 'text') {
                         $prefix[] = 'Content-Type: text/plain; charset=' .
 $this->charset;
                 } elseif ($this->sendAs === 'html') {
                         $prefix[] = 'Content-Type: text/html; charset=' .
 $this->charset;
                 } elseif ($this->sendAs === 'both') {
                         $prefix[] = 'Content-Type: multipart/alternative;
 boundary="alt-' . $this->__boundary . '"';
                 }
                 $prefix[] = 'Content-Transfer-Encoding: 7bit';
                 $prefix[] = '';
                 $message = array_merge($prefix, $message);
         }
         return $message;
 }
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6475>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to 
tickets-cakephp+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to