Methods
Included Modules
Public Instance methods
encode( text, charset="utf-8" )
     # File test/mail_service_test.rb, line 279
279:   def encode( text, charset="utf-8" )
280:     quoted_printable( text, charset )
281:   end
new_mail( charset="utf-8" )
     # File test/mail_service_test.rb, line 283
283:   def new_mail( charset="utf-8" )
284:     mail = TMail::Mail.new
285:     if charset
286:       mail.set_content_type "text", "plain", { "charset" => charset }
287:     end
288:     mail
289:   end
setup()
     # File test/mail_service_test.rb, line 291
291:   def setup
292:     ActionMailer::Base.delivery_method = :test
293:     ActionMailer::Base.perform_deliveries = true
294:     ActionMailer::Base.deliveries = []
295: 
296:     @recipient = 'test@localhost'
297:   end
test_attachment_using_content_location()
     # File test/mail_service_test.rb, line 619
619:   def test_attachment_using_content_location
620:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email12")
621:     mail = TMail::Mail.parse(fixture)
622:     assert_equal 1, mail.attachments.length
623:     assert_equal "Photo25.jpg", mail.attachments.first.original_filename
624:   end
test_attachment_with_custom_header()
     # File test/mail_service_test.rb, line 312
312:   def test_attachment_with_custom_header
313:     created = nil
314:     assert_nothing_raised { created = TestMailer.create_attachment_with_custom_header(@recipient)}
315:     assert_equal "<test@test.com>", created.parts[1].header['content-id'].to_s
316:   end
test_attachment_with_text_type()
     # File test/mail_service_test.rb, line 626
626:   def test_attachment_with_text_type
627:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email13")
628:     mail = TMail::Mail.parse(fixture)
629:     assert mail.has_attachments?
630:     assert_equal 1, mail.attachments.length
631:     assert_equal "hello.rb", mail.attachments.first.original_filename
632:   end
test_cancelled_account()
     # File test/mail_service_test.rb, line 351
351:   def test_cancelled_account
352:     expected = new_mail
353:     expected.to      = @recipient
354:     expected.subject = "[Cancelled] Goodbye #{@recipient}"
355:     expected.body    = "Goodbye, Mr. #{@recipient}"
356:     expected.from    = "system@loudthinking.com"
357:     expected.date    = Time.local(2004, 12, 12)
358: 
359:     created = nil
360:     assert_nothing_raised { created = TestMailer.create_cancelled_account(@recipient) }
361:     assert_not_nil created
362:     assert_equal expected.encoded, created.encoded
363: 
364:     assert_nothing_raised { TestMailer.deliver_cancelled_account(@recipient) }
365:     assert_not_nil ActionMailer::Base.deliveries.first
366:     assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
367:   end
test_cc_bcc()
     # File test/mail_service_test.rb, line 369
369:   def test_cc_bcc
370:     expected = new_mail
371:     expected.to      = @recipient
372:     expected.subject = "testing bcc/cc"
373:     expected.body    = "Nothing to see here."
374:     expected.from    = "system@loudthinking.com"
375:     expected.cc      = "nobody@loudthinking.com"
376:     expected.bcc     = "root@loudthinking.com"
377:     expected.date    = Time.local 2004, 12, 12
378: 
379:     created = nil
380:     assert_nothing_raised do
381:       created = TestMailer.create_cc_bcc @recipient
382:     end
383:     assert_not_nil created
384:     assert_equal expected.encoded, created.encoded
385: 
386:     assert_nothing_raised do
387:       TestMailer.deliver_cc_bcc @recipient
388:     end
389: 
390:     assert_not_nil ActionMailer::Base.deliveries.first
391:     assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
392:   end
test_custom_content_type_attributes()
     # File test/mail_service_test.rb, line 817
817:   def test_custom_content_type_attributes
818:     mail = TestMailer.create_custom_content_type_attributes
819:     assert_match %r{format=flowed}, mail['content-type'].to_s
820:     assert_match %r{charset=utf-8}, mail['content-type'].to_s
821:   end
test_custom_template()
     # File test/mail_service_test.rb, line 337
337:   def test_custom_template
338:     expected = new_mail
339:     expected.to      = @recipient
340:     expected.subject = "[Signed up] Welcome #{@recipient}"
341:     expected.body    = "Hello there, \n\nMr. #{@recipient}"
342:     expected.from    = "system@loudthinking.com"
343:     expected.date    = Time.local(2004, 12, 12)
344: 
345:     created = nil
346:     assert_nothing_raised { created = TestMailer.create_custom_template(@recipient) }
347:     assert_not_nil created
348:     assert_equal expected.encoded, created.encoded
349:   end
test_decode_attachment_without_charset()
     # File test/mail_service_test.rb, line 612
612:   def test_decode_attachment_without_charset
613:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email3")
614:     mail = TMail::Mail.parse(fixture)
615:     attachment = mail.attachments.last
616:     assert_equal 1026, attachment.read.length
617:   end
test_decode_encoded_attachment_filename()
     # File test/mail_service_test.rb, line 766
766:   def test_decode_encoded_attachment_filename
767:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email8")
768:     mail = TMail::Mail.parse(fixture)
769:     attachment = mail.attachments.last
770:     assert_equal "01QuienTeDijat.Pitbull.mp3", attachment.original_filename
771:   end
test_decode_message_with_incorrect_charset()
     # File test/mail_service_test.rb, line 646
646:   def test_decode_message_with_incorrect_charset
647:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email6")
648:     mail = TMail::Mail.parse(fixture)
649:     assert_nothing_raised { mail.body }
650:   end
test_decode_message_with_unknown_charset()
     # File test/mail_service_test.rb, line 778
778:   def test_decode_message_with_unknown_charset
779:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email10")
780:     mail = TMail::Mail.parse(fixture)
781:     assert_nothing_raised { mail.body }
782:   end
test_decode_message_with_unquoted_atchar_in_header()
     # File test/mail_service_test.rb, line 784
784:   def test_decode_message_with_unquoted_atchar_in_header
785:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email11")
786:     mail = TMail::Mail.parse(fixture)
787:     assert_not_nil mail.from
788:   end
test_decode_message_without_content_type()
     # File test/mail_service_test.rb, line 640
640:   def test_decode_message_without_content_type
641:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email5")
642:     mail = TMail::Mail.parse(fixture)
643:     assert_nothing_raised { mail.body }
644:   end
test_decode_part_without_content_type()
     # File test/mail_service_test.rb, line 634
634:   def test_decode_part_without_content_type
635:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email4")
636:     mail = TMail::Mail.parse(fixture)
637:     assert_nothing_raised { mail.body }
638:   end
test_deliver_with_mail_object()
     # File test/mail_service_test.rb, line 806
806:   def test_deliver_with_mail_object
807:     mail = TestMailer.create_headers_with_nonalpha_chars(@recipient)
808:     assert_nothing_raised { TestMailer.deliver(mail) }
809:     assert_equal 1, TestMailer.deliveries.length
810:   end
test_deliveries_array()
     # File test/mail_service_test.rb, line 449
449:   def test_deliveries_array
450:     assert_not_nil ActionMailer::Base.deliveries
451:     assert_equal 0, ActionMailer::Base.deliveries.size
452:     TestMailer.deliver_signed_up(@recipient)
453:     assert_equal 1, ActionMailer::Base.deliveries.size
454:     assert_not_nil ActionMailer::Base.deliveries.first
455:   end
test_empty_header_values_omitted()
     # File test/mail_service_test.rb, line 790
790:   def test_empty_header_values_omitted
791:     result = TestMailer.create_unnamed_attachment(@recipient).encoded
792:     assert_match %r{Content-Type: application/octet-stream[^;]}, result
793:     assert_match %r{Content-Disposition: attachment[^;]}, result
794:   end
test_explicitly_multipart_messages()
     # File test/mail_service_test.rb, line 667
667:   def test_explicitly_multipart_messages
668:     mail = TestMailer.create_explicitly_multipart_example(@recipient)
669:     assert_equal 3, mail.parts.length
670:     assert_nil mail.content_type
671:     assert_equal "text/plain", mail.parts[0].content_type
672: 
673:     assert_equal "text/html", mail.parts[1].content_type
674:     assert_equal "iso-8859-1", mail.parts[1].sub_header("content-type", "charset")
675:     assert_equal "inline", mail.parts[1].content_disposition
676: 
677:     assert_equal "image/jpeg", mail.parts[2].content_type
678:     assert_equal "attachment", mail.parts[2].content_disposition
679:     assert_equal "foo.jpg", mail.parts[2].sub_header("content-disposition", "filename")
680:     assert_equal "foo.jpg", mail.parts[2].sub_header("content-type", "name")
681:     assert_nil mail.parts[2].sub_header("content-type", "charset")
682:   end
test_explicitly_multipart_with_content_type()
     # File test/mail_service_test.rb, line 684
684:   def test_explicitly_multipart_with_content_type
685:     mail = TestMailer.create_explicitly_multipart_example(@recipient, "multipart/alternative")
686:     assert_equal 3, mail.parts.length
687:     assert_equal "multipart/alternative", mail.content_type
688:   end
test_explicitly_multipart_with_invalid_content_type()
     # File test/mail_service_test.rb, line 690
690:   def test_explicitly_multipart_with_invalid_content_type
691:     mail = TestMailer.create_explicitly_multipart_example(@recipient, "text/xml")
692:     assert_equal 3, mail.parts.length
693:     assert_nil mail.content_type
694:   end
test_extended_headers()
     # File test/mail_service_test.rb, line 539
539:   def test_extended_headers
540:     @recipient = "Grytøyr <test@localhost>"
541: 
542:     expected = new_mail "iso-8859-1"
543:     expected.to      = quote_address_if_necessary @recipient, "iso-8859-1"
544:     expected.subject = "testing extended headers"
545:     expected.body    = "Nothing to see here."
546:     expected.from    = quote_address_if_necessary "Grytøyr <stian1@example.net>", "iso-8859-1"
547:     expected.cc      = quote_address_if_necessary "Grytøyr <stian2@example.net>", "iso-8859-1"
548:     expected.bcc     = quote_address_if_necessary "Grytøyr <stian3@example.net>", "iso-8859-1"
549:     expected.date    = Time.local 2004, 12, 12
550: 
551:     created = nil
552:     assert_nothing_raised do
553:       created = TestMailer.create_extended_headers @recipient
554:     end
555: 
556:     assert_not_nil created
557:     assert_equal expected.encoded, created.encoded
558: 
559:     assert_nothing_raised do
560:       TestMailer.deliver_extended_headers @recipient
561:     end
562: 
563:     assert_not_nil ActionMailer::Base.deliveries.first
564:     assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
565:   end
test_headers_removed_on_smtp_delivery()
     # File test/mail_service_test.rb, line 749
749:   def test_headers_removed_on_smtp_delivery
750:     ActionMailer::Base.delivery_method = :smtp
751:     TestMailer.deliver_cc_bcc(@recipient)
752:     assert MockSMTP.deliveries[0][2].include?("root@loudthinking.com")
753:     assert MockSMTP.deliveries[0][2].include?("nobody@loudthinking.com")
754:     assert MockSMTP.deliveries[0][2].include?(@recipient)
755:     assert_match %r{^Cc: nobody@loudthinking.com}, MockSMTP.deliveries[0][0]
756:     assert_match %r{^To: #{@recipient}}, MockSMTP.deliveries[0][0]
757:     assert_no_match %r{^Bcc: root@loudthinking.com}, MockSMTP.deliveries[0][0]
758:   end
test_headers_with_nonalpha_chars()
     # File test/mail_service_test.rb, line 796
796:   def test_headers_with_nonalpha_chars
797:     mail = TestMailer.create_headers_with_nonalpha_chars(@recipient)
798:     assert !mail.from_addrs.empty?
799:     assert !mail.cc_addrs.empty?
800:     assert !mail.bcc_addrs.empty?
801:     assert_match(/:/, mail.from_addrs.to_s)
802:     assert_match(/:/, mail.cc_addrs.to_s)
803:     assert_match(/:/, mail.bcc_addrs.to_s)
804:   end
test_html_mail()
     # File test/mail_service_test.rb, line 727
727:   def test_html_mail
728:     mail = TestMailer.create_html_mail(@recipient)
729:     assert_equal "text/html", mail.content_type
730:   end
test_html_mail_with_underscores()
     # File test/mail_service_test.rb, line 732
732:   def test_html_mail_with_underscores
733:     mail = TestMailer.create_html_mail_with_underscores(@recipient)
734:     assert_equal %{<a href="http://google.com" target="_blank">_Google</a>}, mail.body
735:   end
test_implicitly_multipart_messages()
     # File test/mail_service_test.rb, line 696
696:   def test_implicitly_multipart_messages
697:     mail = TestMailer.create_implicitly_multipart_example(@recipient)
698:     assert_equal 3, mail.parts.length
699:     assert_equal "1.0", mail.mime_version
700:     assert_equal "multipart/alternative", mail.content_type
701:     assert_equal "text/yaml", mail.parts[0].content_type
702:     assert_equal "utf-8", mail.parts[0].sub_header("content-type", "charset")
703:     assert_equal "text/plain", mail.parts[1].content_type
704:     assert_equal "utf-8", mail.parts[1].sub_header("content-type", "charset")
705:     assert_equal "text/html", mail.parts[2].content_type
706:     assert_equal "utf-8", mail.parts[2].sub_header("content-type", "charset")
707:   end
test_implicitly_multipart_messages_with_charset()
     # File test/mail_service_test.rb, line 717
717:   def test_implicitly_multipart_messages_with_charset
718:     mail = TestMailer.create_implicitly_multipart_example(@recipient, 'iso-8859-1')
719: 
720:     assert_equal "multipart/alternative", mail.header['content-type'].body
721:     
722:     assert_equal 'iso-8859-1', mail.parts[0].sub_header("content-type", "charset")
723:     assert_equal 'iso-8859-1', mail.parts[1].sub_header("content-type", "charset")
724:     assert_equal 'iso-8859-1', mail.parts[2].sub_header("content-type", "charset")
725:   end
test_implicitly_multipart_messages_with_custom_order()
     # File test/mail_service_test.rb, line 709
709:   def test_implicitly_multipart_messages_with_custom_order
710:     mail = TestMailer.create_implicitly_multipart_example(@recipient, nil, ["text/yaml", "text/plain"])
711:     assert_equal 3, mail.parts.length
712:     assert_equal "text/html", mail.parts[0].content_type
713:     assert_equal "text/plain", mail.parts[1].content_type
714:     assert_equal "text/yaml", mail.parts[2].content_type
715:   end
test_implicitly_multipart_with_utf8()
     # File test/mail_service_test.rb, line 662
662:   def test_implicitly_multipart_with_utf8
663:     mail = TestMailer.create_implicitly_multipart_with_utf8
664:     assert_match(/\nSubject: =\?utf-8\?Q\?Foo_.*?\?=/, mail.encoded)
665:   end
test_instances_are_nil()
     # File test/mail_service_test.rb, line 444
444:   def test_instances_are_nil
445:     assert_nil ActionMailer::Base.new
446:     assert_nil TestMailer.new
447:   end
test_iso_charset()
     # File test/mail_service_test.rb, line 394
394:   def test_iso_charset
395:     expected = new_mail( "iso-8859-1" )
396:     expected.to      = @recipient
397:     expected.subject = encode "testing isø charsets", "iso-8859-1"
398:     expected.body    = "Nothing to see here."
399:     expected.from    = "system@loudthinking.com"
400:     expected.cc      = "nobody@loudthinking.com"
401:     expected.bcc     = "root@loudthinking.com"
402:     expected.date    = Time.local 2004, 12, 12
403: 
404:     created = nil
405:     assert_nothing_raised do
406:       created = TestMailer.create_iso_charset @recipient
407:     end
408:     assert_not_nil created
409:     assert_equal expected.encoded, created.encoded
410: 
411:     assert_nothing_raised do
412:       TestMailer.deliver_iso_charset @recipient
413:     end
414: 
415:     assert_not_nil ActionMailer::Base.deliveries.first
416:     assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
417:   end
test_multipart_with_mime_version()
     # File test/mail_service_test.rb, line 652
652:   def test_multipart_with_mime_version
653:     mail = TestMailer.create_multipart_with_mime_version(@recipient)
654:     assert_equal "1.1", mail.mime_version
655:   end
test_multipart_with_template_path_with_dots()
     # File test/mail_service_test.rb, line 812
812:   def test_multipart_with_template_path_with_dots
813:     mail = FunkyPathMailer.create_multipart_with_template_path_with_dots(@recipient)
814:     assert_equal 2, mail.parts.length
815:   end
test_multipart_with_utf8_subject()
     # File test/mail_service_test.rb, line 657
657:   def test_multipart_with_utf8_subject
658:     mail = TestMailer.create_multipart_with_utf8_subject(@recipient)
659:     assert_match(/\nSubject: =\?utf-8\?Q\?Foo_.*?\?=/, mail.encoded)
660:   end
test_multiple_utf8_recipients()
     # File test/mail_service_test.rb, line 582
582:   def test_multiple_utf8_recipients
583:     @recipient = ["\"Foo áëô îü\" <extended@example.net>", "\"Example Recipient\" <me@example.com>"]
584:     expected = new_mail "utf-8"
585:     expected.to      = quote_address_if_necessary @recipient, "utf-8"
586:     expected.subject = "testing utf-8 body"
587:     expected.body    = "åœö blah"
588:     expected.from    = quote_address_if_necessary @recipient.first, "utf-8"
589:     expected.cc      = quote_address_if_necessary @recipient, "utf-8"
590:     expected.bcc     = quote_address_if_necessary @recipient, "utf-8"
591:     expected.date    = Time.local 2004, 12, 12
592: 
593:     created = TestMailer.create_utf8_body @recipient
594:     assert_match(/\nFrom: =\?utf-8\?Q\?Foo_.*?\?= <extended@example.net>\r/, created.encoded)
595:     assert_match(/\nTo: =\?utf-8\?Q\?Foo_.*?\?= <extended@example.net>, Example Recipient <me/, created.encoded)
596:   end
test_nested_parts()
     # File test/mail_service_test.rb, line 299
299:   def test_nested_parts
300:     created = nil
301:     assert_nothing_raised { created = TestMailer.create_nested_multipart(@recipient)}
302:     assert_equal 2,created.parts.size
303:     assert_equal 2,created.parts.first.parts.size
304:     
305:     assert_equal "multipart/mixed", created.content_type
306:     assert_equal "multipart/alternative", created.parts.first.content_type
307:     assert_equal "text/plain", created.parts.first.parts.first.content_type
308:     assert_equal "text/html", created.parts.first.parts[1].content_type
309:     assert_equal "application/octet-stream", created.parts[1].content_type
310:   end
test_perform_deliveries_flag()
     # File test/mail_service_test.rb, line 457
457:   def test_perform_deliveries_flag
458:     ActionMailer::Base.perform_deliveries = false
459:     TestMailer.deliver_signed_up(@recipient)
460:     assert_equal 0, ActionMailer::Base.deliveries.size
461:     ActionMailer::Base.perform_deliveries = true
462:     TestMailer.deliver_signed_up(@recipient)
463:     assert_equal 1, ActionMailer::Base.deliveries.size
464:   end
test_receive_attachments()
     # File test/mail_service_test.rb, line 604
604:   def test_receive_attachments
605:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email2")
606:     mail = TMail::Mail.parse(fixture)
607:     attachment = mail.attachments.last
608:     assert_equal "smime.p7s", attachment.original_filename
609:     assert_equal "application/pkcs7-signature", attachment.content_type
610:   end
test_receive_decodes_base64_encoded_mail()
     # File test/mail_service_test.rb, line 598
598:   def test_receive_decodes_base64_encoded_mail
599:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email")
600:     TestMailer.receive(fixture)
601:     assert_match(/Jamis/, TestMailer.received_body)
602:   end
test_recursive_multipart_processing()
     # File test/mail_service_test.rb, line 760
760:   def test_recursive_multipart_processing
761:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email7")
762:     mail = TMail::Mail.parse(fixture)
763:     assert_equal "This is the first part.\n\nAttachment: test.rb\nAttachment: test.pdf\n\n\nAttachment: smime.p7s\n", mail.body
764:   end
test_signed_up()
     # File test/mail_service_test.rb, line 318
318:   def test_signed_up
319:     expected = new_mail
320:     expected.to      = @recipient
321:     expected.subject = "[Signed up] Welcome #{@recipient}"
322:     expected.body    = "Hello there, \n\nMr. #{@recipient}"
323:     expected.from    = "system@loudthinking.com"
324:     expected.date    = Time.local(2004, 12, 12)
325:     expected.mime_version = nil
326: 
327:     created = nil
328:     assert_nothing_raised { created = TestMailer.create_signed_up(@recipient) }
329:     assert_not_nil created
330:     assert_equal expected.encoded, created.encoded
331: 
332:     assert_nothing_raised { TestMailer.deliver_signed_up(@recipient) }
333:     assert_not_nil ActionMailer::Base.deliveries.first
334:     assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
335:   end
test_unencoded_subject()
     # File test/mail_service_test.rb, line 419
419:   def test_unencoded_subject
420:     expected = new_mail
421:     expected.to      = @recipient
422:     expected.subject = "testing unencoded subject"
423:     expected.body    = "Nothing to see here."
424:     expected.from    = "system@loudthinking.com"
425:     expected.cc      = "nobody@loudthinking.com"
426:     expected.bcc     = "root@loudthinking.com"
427:     expected.date    = Time.local 2004, 12, 12
428: 
429:     created = nil
430:     assert_nothing_raised do
431:       created = TestMailer.create_unencoded_subject @recipient
432:     end
433:     assert_not_nil created
434:     assert_equal expected.encoded, created.encoded
435: 
436:     assert_nothing_raised do
437:       TestMailer.deliver_unencoded_subject @recipient
438:     end
439: 
440:     assert_not_nil ActionMailer::Base.deliveries.first
441:     assert_equal expected.encoded, ActionMailer::Base.deliveries.first.encoded
442:   end
test_unquote_7bit_body()
     # File test/mail_service_test.rb, line 494
494:   def test_unquote_7bit_body
495:     msg = "From: me@example.com\nSubject: subject\nContent-Type: text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: 7bit\n\nThe=3Dbody\n"
496:     mail = TMail::Mail.parse(msg)
497:     assert_equal "The=3Dbody", mail.body.strip
498:     assert_equal "The=3Dbody", mail.quoted_body.strip
499:   end
test_unquote_7bit_subject()
     # File test/mail_service_test.rb, line 480
480:   def test_unquote_7bit_subject
481:     msg = "From: me@example.com\nSubject: this == working?\nContent-Type: text/plain; charset=iso-8859-1\n\nThe body\n"
482:     mail = TMail::Mail.parse(msg)
483:     assert_equal "this == working?", mail.subject
484:     assert_equal "this == working?", mail.quoted_subject
485:   end
test_unquote_base64_body()
     # File test/mail_service_test.rb, line 524
524:   def test_unquote_base64_body
525:     msg = "From: me@example.com\nSubject: subject\nContent-Type: text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: base64\n\nVGhlIGJvZHk=\n"
526:     mail = TMail::Mail.parse(msg)
527:     assert_equal "The body", mail.body.strip
528:     assert_equal "VGhlIGJvZHk=", mail.quoted_body.strip
529:   end
test_unquote_quoted_printable_body()
     # File test/mail_service_test.rb, line 509
509:   def test_unquote_quoted_printable_body
510:     msg = "From: me@example.com\nSubject: subject\nContent-Type: text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: quoted-printable\n\nThe=3Dbody\n"
511:     mail = TMail::Mail.parse(msg)
512:     assert_equal "The=body", mail.body.strip
513:     assert_equal "The=3Dbody", mail.quoted_body.strip
514:   end
test_unquote_quoted_printable_subject()
     # File test/mail_service_test.rb, line 466
466:   def test_unquote_quoted_printable_subject
467:     msg = "From: me@example.com\nSubject: =?utf-8?Q?testing_testing_=D6=A4?=\nContent-Type: text/plain; charset=iso-8859-1\n\nThe body\n"
468:     mail = TMail::Mail.parse(msg)
469:     assert_equal "testing testing \326\244", mail.subject
470:     assert_equal "=?utf-8?Q?testing_testing_=D6=A4?=", mail.quoted_subject
471:   end
test_utf8_body_is_not_quoted()
     # File test/mail_service_test.rb, line 567
567:   def test_utf8_body_is_not_quoted
568:     @recipient = "Foo áëô îü <extended@example.net>"
569:     expected = new_mail "utf-8"
570:     expected.to      = quote_address_if_necessary @recipient, "utf-8"
571:     expected.subject = "testing utf-8 body"
572:     expected.body    = "åœö blah"
573:     expected.from    = quote_address_if_necessary @recipient, "utf-8"
574:     expected.cc      = quote_address_if_necessary @recipient, "utf-8"
575:     expected.bcc     = quote_address_if_necessary @recipient, "utf-8"
576:     expected.date    = Time.local 2004, 12, 12
577: 
578:     created = TestMailer.create_utf8_body @recipient
579:     assert_match(/åœö blah/, created.encoded)
580:   end
test_various_newlines()
     # File test/mail_service_test.rb, line 737
737:   def test_various_newlines
738:     mail = TestMailer.create_various_newlines(@recipient)
739:     assert_equal("line #1\nline #2\nline #3\nline #4\n\n" +
740:                  "line #5\n\nline#6\n\nline #7", mail.body)
741:   end
test_various_newlines_multipart()
     # File test/mail_service_test.rb, line 743
743:   def test_various_newlines_multipart
744:     mail = TestMailer.create_various_newlines_multipart(@recipient)
745:     assert_equal "line #1\nline #2\nline #3\nline #4\n\n", mail.parts[0].body
746:     assert_equal "<p>line #1</p>\n<p>line #2</p>\n<p>line #3</p>\n<p>line #4</p>\n\n", mail.parts[1].body
747:   end
test_wrong_mail_header()
     # File test/mail_service_test.rb, line 773
773:   def test_wrong_mail_header
774:     fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email9")
775:     assert_raise(TMail::SyntaxError) { TMail::Mail.parse(fixture) }
776:   end