Changeset 915
- Timestamp:
- 07/21/08 18:36:52 (3 months ago)
- Files:
-
- branches/action_mailer/lib/AkActionMailer.php (modified) (13 diffs)
- branches/action_mailer/lib/AkActionMailer/AkActionMailerQuoting.php (modified) (1 diff)
- branches/action_mailer/lib/AkActionMailer/AkMail.php (deleted)
- branches/action_mailer/lib/AkActionMailer/AkMailBase.php (added)
- branches/action_mailer/lib/AkActionMailer/AkMailComposer.php (added)
- branches/action_mailer/lib/AkActionMailer/AkMailEncoder.php (modified) (1 diff)
- branches/action_mailer/lib/AkActionMailer/AkMailHeader.php (added)
- branches/action_mailer/lib/AkActionMailer/AkMailMessage.php (added)
- branches/action_mailer/lib/AkActionMailer/AkMailParser.php (modified) (4 diffs)
- branches/action_mailer/lib/AkActionMailer/AkMailPart.php (added)
- branches/action_mailer/test/fixtures/app/models/test_mailer.php (modified) (9 diffs)
- branches/action_mailer/test/fixtures/app/views/test_mailer/multipart_rendering.text.html.tpl (modified) (1 diff)
- branches/action_mailer/test/unit/lib/AkActionMailer.php (modified) (20 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/action_mailer/lib/AkActionMailer.php
r887 r915 18 18 19 19 require_once(AK_LIB_DIR.DS.'AkBaseModel.php'); 20 require_once(AK_LIB_DIR.DS.'AkActionMailer'.DS.'AkMail .php');20 require_once(AK_LIB_DIR.DS.'AkActionMailer'.DS.'AkMailMessage.php'); 21 21 require_once(AK_LIB_DIR.DS.'AkActionMailer'.DS.'AkMailParser.php'); 22 22 require_once(AK_LIB_DIR.DS.'AkActionMailer'.DS.'AkActionMailerQuoting.php'); … … 276 276 var $helpers = array('mail'); 277 277 var $_MailDriver; 278 var $_defaultMailDriverName = 'AkMail ';278 var $_defaultMailDriverName = 'AkMailMessage'; 279 279 280 280 function __construct($Driver = null) … … 456 456 { 457 457 $args = func_get_args(); 458 print_r($args);459 458 return call_user_func_array(array(&$this->_MailDriver, 'setAttachment'), $args); 460 459 } … … 468 467 * This simplifies creating mail objects from datasources. 469 468 * 470 * If the metho sdoes not exists the parameter will be added to the body.469 * If the method does not exists the parameter will be added to the body. 471 470 */ 472 471 function set($attributes = array()) … … 476 475 unset($attributes['template']); 477 476 } 477 478 if((!empty($attributes['attachment']) || !empty($attributes['attachments'])) && 479 (empty($attributes['parts']) && empty($attributes['part']) && empty($attributes['body']))){ 480 // we can render here the body if there are attachments 481 } 482 478 483 $this->_MailDriver->set($attributes); 479 484 } 485 480 486 481 487 /** … … 514 520 function receive($raw_mail) 515 521 { 516 $this->_MailDriver =& AkMail ::parse($raw_mail);522 $this->_MailDriver =& AkMailBase::parse($raw_mail); 517 523 return $this->_MailDriver; 518 524 } … … 529 535 function deliverDirectly(&$Mail) 530 536 { 531 $Mail =& new AkMail($Mail);537 $Mail =& new $this->_defaultMailDriverName ($Mail); 532 538 $Mail->send(); 533 539 } … … 536 542 /** 537 543 * Initialize the mailer via the given +method_name+. The body will be 538 * rendered and a new AkMail object created.544 * rendered and a new AkMailMessage object created. 539 545 */ 540 546 function &create($method_name, $parameters, $content_type = '') … … 549 555 } 550 556 $parameters = @array_shift($args); 551 $content_type = @array_shift($args);552 557 553 558 $Mail =& $this->_MailDriver; 559 560 $this->_prepareInlineBodyParts($Mail); 561 562 $Mail->setMimeVersion((empty($Mail->mime_version) && !empty($Mail->parts)) ? '1.0' : $Mail->mime_version); 563 564 $this->Mail =& $Mail; 565 return $Mail; 566 } 567 568 function _prepareInlineBodyParts(&$Mail, $mail_content_type = 'multipart/alternative') 569 { 554 570 555 571 if(!is_string($Mail->body)){ … … 557 573 $Mail->_avoid_multipart_propagation = true; 558 574 $templates = $this->_getAvailableTemplates(); 575 $alternative_multiparts = array(); 559 576 foreach ($templates as $template_name){ 560 577 if(preg_match('/^([^\.]+)\.([^\.]+\.[^\.]+)\.(tpl)$/',$template_name, $match)){ 561 578 if($this->template == $match[1]){ 562 579 $content_type = str_replace('.','/', $match[2]); 563 $Mail->setPart(array( 580 581 $current_part = array( 564 582 'content_type' => $content_type, 565 583 'disposition' => 'inline', 566 584 'charset' => @$Mail->charset, 567 'body' => $this->renderMessage($this->getTemplatePath().DS.$template_name, $Mail->body))); 585 'body' => $this->renderMessage($this->getTemplatePath().DS.$template_name, $Mail->body)); 586 587 $Mail->setPart($current_part); 568 588 } 569 589 } 570 590 } 591 571 592 if(!empty($Mail->parts)){ 572 $Mail->content_type = 'multipart/alternative';593 $Mail->content_type = $mail_content_type; 573 594 $Mail->parts = $Mail->getSortedParts($Mail->parts, $Mail->implicit_parts_order); 574 595 } … … 595 616 } 596 617 } 597 598 $Mail->setMimeVersion((empty($Mail->mime_version) && !empty($Mail->parts)) ? '1.0' : $Mail->mime_version);599 600 $this->Mail =& $Mail;601 return $Mail;602 618 } 603 619 … … 612 628 613 629 /** 614 * Delivers an AkMail object. By default, it delivers the cached mail630 * Delivers an AkMailMessage object. By default, it delivers the cached mail 615 631 * object (from the AkActionMailer::create method). If no cached mail object exists, and 616 632 * no alternate has been given as the parameter, this will fail. … … 700 716 function performTestDelivery(&$Mail) 701 717 { 702 //$this->performSmtpDelivery($Mail); return ;718 //$this->performSmtpDelivery($Mail); 703 719 $this->deliveries[] =& $Mail->getEncoded(); 704 720 } branches/action_mailer/lib/AkActionMailer/AkActionMailerQuoting.php
r887 r915 49 49 50 50 $line = preg_replace($search_pattern, 'sprintf( "=%02X", ord ( "$0" ) ) ;', $line ); 51 $length = utf8_strlen($line);51 $length = strlen($line); 52 52 53 53 $last_char = ord($line[$length-1]); branches/action_mailer/lib/AkActionMailer/AkMailEncoder.php
r887 r915 1 1 <?php 2 2 3 class AkMailEncoder extends Mail_mimeEncode3 class AkMailEncoder extends AkObject 4 4 { 5 5 6 6 7 8 9 7 10 function setMimeContents($options = array()) 8 11 { branches/action_mailer/lib/AkActionMailer/AkMailParser.php
r824 r915 32 32 } 33 33 34 function parse($raw_message = '', $options = array() )34 function parse($raw_message = '', $options = array(), $object_type = 'AkMailMessage') 35 35 { 36 36 $parser_class = empty($options['parser_class']) ? 'AkMailParser' : $options['parser_class']; 37 37 $Parser =& new $parser_class($options); 38 $Mail = new stdClass();38 $Mail = new $object_type(); 39 39 $raw_message = empty($raw_message) ? $Parser->raw_message : $raw_message; 40 40 if(!empty($raw_message)){ … … 90 90 return false; 91 91 }else{ 92 $Part = $Parser->parse($raw_part );92 $Part = $Parser->parse($raw_part, array(), 'AkMailPart'); 93 93 } 94 94 $this->parts[] = $Part; … … 228 228 $header['encoded'] = $header['value']; 229 229 $header['value'] = $header_value; 230 isset($charset) && $header['charset'] = $charset; 230 231 } 231 232 } … … 281 282 } 282 283 284 285 function importStructure(&$MailOrPart, $structure = array()) 286 { 287 if(isset($structure['header'])){ 288 $structure['headers'] = $structure['header']; 289 unset($structure['header']); 290 } 291 foreach ($structure as $attribute=>$value){ 292 if($attribute[0] != '_'){ 293 $attribute_setter = 'set'.AkInflector::camelize($attribute); 294 if(method_exists($MailOrPart, $attribute_setter)){ 295 $MailOrPart->$attribute_setter($value); 296 }else{ 297 $MailOrPart->{AkInflector::underscore($attribute)} = $value; 298 } 299 } 300 } 301 return ; 302 } 303 304 305 function extractImagesIntoInlineParts(&$Mail, $options = array()) 306 { 307 $html =& $Mail->body; 308 require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'text_helper.php'); 309 $images = TextHelper::get_image_urls_from_html($html); 310 $html_images = array(); 311 if(!empty($images)){ 312 require_once(AK_LIB_DIR.DS.'AkImage.php'); 313 require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'asset_tag_helper.php'); 314 315 $images = array_diff(array_unique($images), array('')); 316 317 foreach ($images as $image){ 318 $original_image_name = $image; 319 $image = $this->_getImagePath($image); 320 if(!empty($image)){ 321 $extenssion = substr($image, strrpos('.'.$image,'.')); 322 $image_name = Ak::uuid().'.'.$extenssion; 323 $html_images[$original_image_name] = 'cid:'.$image_name; 324 325 $Mail->setAttachment('image/'.$extenssion, array( 326 'body' => Ak::file_get_contents($image), 327 'filename' => $image_name, 328 'content_disposition' => 'inline', 329 'content_id' => '<'.$image_name.'>', 330 )); 331 } 332 } 333 $modified_html = str_replace(array_keys($html_images),array_values($html_images), $html); 334 if($modified_html != $html){ 335 $html = $modified_html; 336 $Mail->_moveBodyToInlinePart(false); 337 } 338 } 339 } 340 341 function _getImagePath($path) 342 { 343 if(preg_match('/^http(s)?:\/\//', $path)){ 344 $path_info = pathinfo($path); 345 $base_file_name = Ak::sanitize_include($path_info['basename'], 'paranaoid'); 346 if(empty($path_info['extension'])){ // no extension, we don't do magic stuff 347 $path = ''; 348 }else{ 349 $local_path = AK_TMP_DIR.DS.'mailer'.DS.'remote_images'.DS.md5($base_file_name['dirname']).DS.$base_file_name.'.'.$path_info['extension']; 350 if(!file_exists($local_path) || (time() > @filemtime($local_path)+7200)){ 351 if(!Ak::file_put_contents($local_path, Ak::url_get_contents($path))){ 352 return ''; 353 } 354 } 355 return $local_path; 356 } 357 } 358 359 $path = AK_PUBLIC_DIR.Ak::sanitize_include($path); 360 361 if(!file_exists($path)){ 362 $path = ''; 363 } 364 return $path; 365 } 366 283 367 } 284 368 branches/action_mailer/test/fixtures/app/models/test_mailer.php
r887 r915 4 4 { 5 5 var $delivery_method = 'test'; 6 6 7 7 function signed_up($recipient) 8 8 { … … 78 78 'bcc' => "Grytøyr <stian3@example.com>", 79 79 'body' => "Nothing to see here.", 80 'charset' => "ISO-8859-1" 80 'charset' => "ISO-8859-1" 81 81 )); 82 82 } … … 119 119 'subject' => "Foo áëô îü", 120 120 'from' => "test@example.com", 121 'charset' => " utf-8",121 'charset' => "UTF-8", 122 122 'parts' => array( 123 123 array('content_type' => 'text/plain', 'body' => 'blah'), … … 234 234 235 235 'parts' => array( 236 array('content_type' => 'multipart/alternative', 'content_disposition' => 'inline', 'headers' => array("Foo" => "bar"), 'parts' => array( 237 array('content_type' => 'text/plain', 'body' => 'test text\nline #2'), 238 array('content_type' => 'text/html', 'body' => '<b>test</b> HTML<br/>\nline #2') 239 ) 240 ), 236 array( 237 'content_type' => 'multipart/alternative', 238 'content_disposition' => 'inline', 239 'headers' => array("Foo" => "bar"), 240 'parts' => array( 241 array('content_type' => 'text/plain', 'body' => "test text\nline #2"), 242 array('content_type' => 'text/html', 'body' => "<b>test</b> HTML<br/>\nline #2") 243 ) 241 244 ), 242 245 ), 246 243 247 'attachment' => array( 244 'content_type' => 'application/octet-stream','filename' => 'test.txt', 'body' => "test abcdefghijklmnopqstuvwxyz"248 'content_type' => 'application/octet-stream','filename' => 'test.txt', 'body' => "test abcdefghijklmnopqstuvwxyz" 245 249 ) 246 250 )); … … 256 260 257 261 'part' => array('content_type' => 'text/html', 'body' => 'yo'), 258 262 259 263 'attachment' => array( 260 'content_type' => 'image/jpeg','filename' => 'test.jpeg', 'body' => "i am not a real picture", 'headers' => array('Content-ID' => '<test@test.com>')261 ) 262 )); 263 } 264 264 'content_type' => 'image/jpeg','filename' => 'test.jpeg', 'body' => "i am not a real picture", 'headers' => array('Content-ID' => '<test@test.com>') 265 ) 266 )); 267 } 268 265 269 function unnamed_attachment($recipient) 266 270 { … … 272 276 273 277 'part' => array('content_type' => 'text/plain', 'body' => 'hullo'), 274 278 275 279 'attachment' => array( 276 'content_type' => 'application/octet-stream','body' => "test abcdefghijklmnopqstuvwxyz"280 'content_type' => 'application/octet-stream','body' => "test abcdefghijklmnopqstuvwxyz" 277 281 ) 278 282 )); … … 290 294 } 291 295 292 296 293 297 function custom_content_type_attributes() 294 298 { … … 308 312 'recipients' => "bermi@bermilabs.com", 309 313 'subject' => "Multipart rendering", 310 'from' => "testing@bermilabs.com" 311 )); 312 313 314 $this->addAttachment('audio/mp3', array( 315 'body'=>file_get_contents(AK_BASE_DIR.DS.'test/fixtures/data/action_mailer/testing.mp3') 316 )); 317 314 'from' => "testing@bermilabs.com", 315 'attachment' => array('content_type' => 'audio/mp3', 'filename' => 'test.mp3', 'body' => file_get_contents(AK_BASE_DIR.DS.'test/fixtures/data/action_mailer/testing.mp3')), 316 )); 317 318 318 return ; 319 319 320 $this->set(array( 320 321 'recipients' => "no.one@example.com", … … 323 324 )); 324 325 } 325 326 326 327 function &receive($raw_email) 327 328 { branches/action_mailer/test/fixtures/app/views/test_mailer/multipart_rendering.text.html.tpl
r887 r915 8 8 <hidden> 9 9 <img src="http://www.bermilabs.com/images/bermilabs_logo.png" /> 10 10 11 <img src="/images/akelos_framework_logo.png" /> 11 12 </hidden> branches/action_mailer/test/unit/lib/AkActionMailer.php
r887 r915 97 97 $headers = array( 98 98 "Subject: =?ISO-8859-1?Q?=C9ste_es_el_sof=E1_del_q_habl=E9_=5B?=\n\r =?ISO-8859-1?Q?Fwd=3A_Sof=E1=2E=5D_?="=>'Subject: Éste es el sofá del q hablé [Fwd: Sofá.]', 99 99 100 100 "Subject: =?ISO-8859-1?Q?=C9ste_es_el_sof=E1_del_q_habl=E9_=5B?==?ISO-8859-1?Q?Fwd=3A_Sof=E1=2E=5D_?="=>'Subject: Éste es el sofá del q hablé [Fwd: Sofá.]', 101 101 102 102 'Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?='=>'Subject: Prüfung Prüfung', 103 103 'Subject: =?iso-8859-1?Q?RV:_=5BFwd:__chiste_inform=E1tico=5D?='=>'Subject: RV: [Fwd: chiste informático]', … … 106 106 'X-Akelos-Random: =?UTF-8?B?ZXN0w6Egw6MgYsOkc8OqNjQ=?='=>'X-Akelos-Random: está ã bäsê64', 107 107 //'X-Akelos-Random: =?ISO-2022-JP?B?GyRCJDMkcyRLJEEkT0AkMyYbKEI=?='=>'X-Akelos-Random: こんにちは世界', 108 108 109 109 'X-Akelos-Random: =?UTF-8?Q?E=C3=B1e_de_Espa=C3=B1a?= =?UTF-8?Q?_Fwd:_?= =?UTF-8?Q?=E3=81=93=E3=82=93=E3=81=AB=E3=81=A1=E3=81=AF=E4=B8=96=E7=95=8C?='=>'X-Akelos-Random: Eñe de España Fwd: こんにちは世界', 110 110 'From: =?ISO-8859-1?Q?Crist=F3bal_G=F3mez_Moreno?= <cristobal@example.com>'=>'From: Cristóbal Gómez Moreno <cristobal@example.com>', 111 111 112 112 "Subject: =?ISO-8859-1?Q?=C9ste_es_el_sof=E1_del_q_habl=E9_=5B?=\n =?ISO-8859-1?Q?Fwd=3A_Sof=E1=2E=5D_?="=>'Subject: Éste es el sofá del q hablé [Fwd: Sofá.]' 113 113 ); … … 124 124 function test_email_quoted_with_0d0a() 125 125 { 126 $Mail = AkMail ::parse(file_get_contents(AK_TEST_DIR.'/fixtures/data/action_mailer/raw_email_quoted_with_0d0a'));126 $Mail = AkMailBase::parse(file_get_contents(AK_TEST_DIR.'/fixtures/data/action_mailer/raw_email_quoted_with_0d0a')); 127 127 $this->assertPattern('/Elapsed time/', $Mail->body); 128 128 } … … 130 130 function test_email_with_partially_quoted_subject() 131 131 { 132 $Mail = AkMail ::parse(file_get_contents(AK_TEST_DIR.'/fixtures/data/action_mailer/raw_email_with_partially_quoted_subject'));132 $Mail = AkMailBase::parse(file_get_contents(AK_TEST_DIR.'/fixtures/data/action_mailer/raw_email_with_partially_quoted_subject')); 133 133 $this->assertEqual("Re: Test: \"\346\274\242\345\255\227\" mid \"\346\274\242\345\255\227\" tail", $Mail->subject); 134 134 } … … 136 136 /**/ 137 137 } 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 138 155 139 156 … … 147 164 function new_mail($charset = 'utf-8') 148 165 { 149 $Mail =& new AkMail ();166 $Mail =& new AkMailMessage(); 150 167 $Mail->setMimeVersion('1.0'); 151 168 $Mail->setContentType('text/plain; charset:'.$charset); … … 157 174 { 158 175 $this->Mailer =& new AkActionMailer(); 159 //$this->Mailer->delivery_method = 'test';176 $this->Mailer->delivery_method = 'test'; 160 177 $this->Mailer->perform_deliveries = true; 161 178 $this->Mailer->deliveries = array(); 162 //$this->recipient = 'test@localhost'; 163 } 164 165 /* 179 $this->recipient = 'test@localhost'; 180 $this->recipient = 'bermi@bermilabs.com'; 181 } 182 183 function __test_multipart_rendering() 184 { 185 186 $TestMailer =& new TestMailer(); 187 $Delivered = $TestMailer->deliver('multipart_rendering', $this->recipient); 188 echo $Delivered->getRawMessage(); 189 190 return ; 191 $ReceivingTestMailer =& new TestMailer(); 192 $Mail =& $ReceivingTestMailer->receive($Delivered->getRawMessage()); 193 $Attachment = Ak::first($Mail->attachments); 194 $this->assertEqual('test.txt', $Attachment->original_filename); 195 $this->assertEqual('test abcdefghijklmnopqstuvwxyz', $Attachment->body); 196 197 $this->assertEqual(trim($Mail->bodyToString()), "test text\nline #2\n\n<b>test</b> HTML<br/>\nline #2\n\n\nAttachment: test.txt"); 198 199 200 201 } 202 203 204 /**/ 166 205 function test_nested_parts() 167 206 { 168 $HelperMailer =& new TestMailer(); 169 $Created = $HelperMailer->create('nested_multipart', $this->recipient); 170 207 $TestMailer =& new TestMailer(); 208 $Created = $TestMailer->create('nested_multipart', $this->recipient); 209 210 171 211 $this->assertEqual(2, count($Created->parts)); 172 212 $this->assertEqual(2, count($Created->parts[0]->parts)); 173 213 $this->assertEqual( "multipart/mixed", $Created->content_type); 174 214 $this->assertEqual( "multipart/alternative", $Created->parts[0]->content_type ); 175 $this->assertEqual( "bar", $Created->parts[0]->header['Foo'] ); 215 $this->assertEqual( "bar", $Created->parts[0]->getHeader('Foo') ); 216 $this->assertEqual( "akmailpart", strtolower(get_class($Created->parts[0]->parts[0]))); 176 217 $this->assertEqual( "text/plain", $Created->parts[0]->parts[0]->content_type ); 218 177 219 $this->assertEqual( "text/html", $Created->parts[0]->parts[1]->content_type ); 178 220 $this->assertEqual( "application/octet-stream", $Created->parts[1]->content_type ); 179 } 180 221 222 223 return; 224 $TestMailer =& new TestMailer(); 225 $Delivered = $TestMailer->deliver('nested_multipart', $this->recipient); 226 227 $ReceivingTestMailer =& new TestMailer(); 228 $Mail =& $ReceivingTestMailer->receive($Delivered->getRawMessage()); 229 $Attachment = Ak::first($Mail->attachments); 230 $this->assertEqual('test.txt', $Attachment->original_filename); 231 $this->assertEqual('test abcdefghijklmnopqstuvwxyz', $Attachment->body); 232 233 $this->assertEqual(trim($Mail->bodyToString()), "test text\nline #2\n\n<b>test</b> HTML<br/>\nline #2\n\n\nAttachment: test.txt"); 234 235 236 } 181 237 182 238 function test_attachment_with_custom_header() 183 239 { 184 $HelperMailer =& new TestMailer(); 185 $Created = $HelperMailer->create('attachment_with_custom_header', $this->recipient); 186 $this->assertEqual( "<test@test.com>", $Created->parts[1]->header['Content-ID']); 187 } 240 $TestMailer =& new TestMailer(); 241 $Created = $TestMailer->create('attachment_with_custom_header', $this->recipient); 242 $this->assertEqual( "<test@test.com>", $Created->parts[1]->getHeader('Content-ID')); 243 } 244 188 245 189 246 function test_signed_up() … … 200 257 $this->assertTrue($Created = $TestMailer->create('signed_up', $this->recipient)); 201 258 $this->assertEqual($Expected->getEncoded(), $Created->getEncoded()); 259 202 260 $this->assertTrue($TestMailer->deliver('signed_up', $this->recipient)); 203 261 $this->assertTrue(!empty($TestMailer->deliveries[0])); 204 262 $this->assertEqual($Expected->getEncoded(), $TestMailer->deliveries[0]); 205 } 206 263 264 } 265 266 207 267 function test_custom_template() 208 268 { … … 216 276 $this->assertTrue($Created = $TestMailer->create('custom_template', $this->recipient)); 217 277 $this->assertEqual($Expected->getEncoded(), $Created->getEncoded()); 278 218 279 } 219 280 … … 259 320 $this->assertEqual($Expected->getEncoded(), $TestMailer->deliveries[0]); 260 321 } 261 262 322 263 323 … … 284 344 $this->assertTrue(!empty($TestMailer->deliveries[0])); 285 345 $this->assertEqual($Expected->getEncoded(), $TestMailer->deliveries[0]); 286 } 287 346 347 $this->assertEqual($Created->getSubject(), '=?ISO-8859-1?Q?testing_is=F8_charsets?='); 348 349 } 288 350 289 351 … … 308 370 $this->assertTrue(!empty($TestMailer->deliveries[0])); 309 371 $this->assertEqual($Expected->getEncoded(), $TestMailer->deliveries[0]); 310 } 311 312 372 373 $this->assertEqual($Created->getSubject(), 'testing unencoded subject'); 374 } 375 376 313 377 function test_perform_deliveries_flag() 314 378 { … … 324 388 325 389 } 390 326 391 327 392 function test_unquote_quoted_printable_subject() … … 335 400 EOF; 336 401 337 $Mail = AkMail ::parse($msg);402 $Mail = AkMailBase::parse($msg); 338 403 $this->assertEqual("testing testing \326\244", $Mail->subject); 339 $this->assertEqual("=?UTF-8?Q?testing_testing_=D6=A4?=", $Mail->getSubject()); 340 341 } 404 $this->assertEqual("=?UTF-8?Q?testing_testing_=D6=A4?=", $Mail->getSubject('UTF-8')); 405 406 } 407 342 408 343 409 function test_unquote_7bit_subject() … … 351 417 EOF; 352 418 353 $Mail = AkMail ::parse($msg);419 $Mail = AkMailBase::parse($msg); 354 420 $this->assertEqual("this == working?", $Mail->subject); 355 421 $this->assertEqual("this == working?", $Mail->getSubject()); … … 369 435 EOF; 370 436 371 $Mail = AkMail ::parse($msg);437 $Mail = AkMailBase::parse($msg); 372 438 $this->assertEqual("The=3Dbody", $Mail->body); 373 439 $this->assertEqual("The=3Dbody", $Mail->getBody()); … … 386 452 EOF; 387 453 388 $Mail = AkMail ::parse($msg);454 $Mail = AkMailBase::parse($msg); 389 455 $this->assertEqual("The=body", $Mail->body); 390 456 $this->assertEqual("The=3Dbody", $Mail->getBody()); … … 403 469 EOF; 404 470 405 $Mail = AkMail ::parse($msg);471 $Mail = AkMailBase::parse($msg); 406 472 $this->assertEqual("The body", $Mail->body); 407 473 $this->assertEqual("VGhlIGJvZHk=", $Mail->getBody()); … … 446 512 $TestMailer =& new TestMailer(); 447 513 $this->assertTrue($Created = $TestMailer->create('utf8_body', $this->recipient)); 514 448 515 $this->assertPattern("/\nFrom: =\?UTF-8\?Q\?Foo_.*?\?= <extended@example.com>\r/", $Created->getEncoded()); 449 516 $this->assertPattern("/To: =\?UTF-8\?Q\?Foo_.*?\?= <extended@example.com>, Ex=\r\n ample Recipient <me/", $Created->getEncoded()); … … 690 757 691 758 /**/ 692 693 function test_should_render_multipart_message()694 {695 $TestMailer =& new TestMailer();696 $TestMailer->deliver('multipart_rendering');697 698 echo $TestMailer->getRawMessage();699 }700 701 702 759 } 703 760 704 //Ak::test('Tests_for_Mailers');761 Ak::test('Tests_for_Mailers'); 705 762 Ak::test('Tests_for_AkActionMailer'); 706 763
