<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Class: TMail::Mail</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="classHeader"> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Class</strong></td> <td class="class-name-in-header">TMail::Mail</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../../files/lib/action_mailer/vendor/tmail-1_2_3/tmail/attachments_rb.html"> lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb </a> <br /> <a href="../../files/lib/action_mailer/vendor/tmail-1_2_3/tmail/interface_rb.html"> lib/action_mailer/vendor/tmail-1.2.3/tmail/interface.rb </a> <br /> <a href="../../files/lib/action_mailer/vendor/tmail-1_2_3/tmail/mail_rb.html"> lib/action_mailer/vendor/tmail-1.2.3/tmail/mail.rb </a> <br /> <a href="../../files/lib/action_mailer/vendor/tmail-1_2_3/tmail/net_rb.html"> lib/action_mailer/vendor/tmail-1.2.3/tmail/net.rb </a> <br /> <a href="../../files/lib/action_mailer/vendor/tmail-1_2_3/tmail/quoting_rb.html"> lib/action_mailer/vendor/tmail-1.2.3/tmail/quoting.rb </a> <br /> </td> </tr> <tr class="top-aligned-row"> <td><strong>Parent:</strong></td> <td> Object </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <h2><a href="Mail.html">Mail</a> Class</h2> <p> Accessing a <a href="../TMail.html">TMail</a> object done via the <a href="Mail.html">TMail::Mail</a> class. As email can be fairly complex creatures, you will find a large amount of accessor and setter methods in this class! </p> <p> Most of the below methods handle the <a href="Mail.html#M000113">header</a>, in fact, what <a href="../TMail.html">TMail</a> does best is handle the <a href="Mail.html#M000113">header</a> of the email object. There are only a few methods that deal directly with the <a href="Mail.html#M000161">body</a> of the email, such as <a href="Mail.html#M000097">base64_encode</a> and <a href="Mail.html#M000099">base64_decode</a>. </p> <h3>Using <a href="../TMail.html">TMail</a> inside your code</h3> <p> The usual way is <a href="Mail.html#M000045">to</a> install the gem (see the {README}[<a href="../../README">README</a>] on how <a href="Mail.html#M000045">to</a> do this) and then put at the top of your class: </p> <pre> require 'tmail' </pre> <p> You can then create a new <a href="../TMail.html">TMail</a> object in your code with: </p> <pre> @email = TMail::Mail.new </pre> <p> Or if you have an email as a string, you can initialize a new <a href="Mail.html">TMail::Mail</a> object and get it <a href="Mail.html#M000045">to</a> <a href="Mail.html#M000109">parse</a> that string for you like so: </p> <pre> @email = TMail::Mail.parse(email_text) </pre> <p> You can also read a single email off the disk, for example: </p> <pre> @email = TMail::Mail.load('filename.txt') </pre> <p> Also, you can read a mailbox (usual unix mbox format) and end up with an array of <a href="../TMail.html">TMail</a> objects by doing something like this: </p> <pre> # Note, we pass true as the last variable to open the mailbox read only mailbox = TMail::UNIXMbox.new("mailbox", nil, true) @emails = [] mailbox.each_port { |m| @emails << TMail::Mail.new(m) } </pre> </div> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000114">[]</a> <a href="#M000117">[]=</a> <a href="#M000112">accept</a> <a href="#M000153">add_date</a> <a href="#M000152">add_message_id</a> <a href="#M000033">attachment?</a> <a href="#M000034">attachments</a> <a href="#M000099">base64_decode</a> <a href="#M000098">base64_decode!</a> <a href="#M000097">base64_encode</a> <a href="#M000096">base64_encode!</a> <a href="#M000047">bcc</a> <a href="#M000050">bcc=</a> <a href="#M000041">bcc_addrs</a> <a href="#M000044">bcc_addrs=</a> <a href="#M000161">body</a> <a href="#M000138">body=</a> <a href="#M000134">body_port</a> <a href="#M000046">cc</a> <a href="#M000049">cc=</a> <a href="#M000040">cc_addrs</a> <a href="#M000043">cc_addrs=</a> <a href="#M000081">charset</a> <a href="#M000082">charset=</a> <a href="#M000126">clear</a> <a href="#M000090">content_disposition</a> <a href="#M000094">content_disposition=</a> <a href="#M000087">content_transfer_encoding</a> <a href="#M000088">content_transfer_encoding=</a> <a href="#M000075">content_type</a> <a href="#M000079">content_type=</a> <a href="#M000146">content_type_is_text?</a> <a href="#M000107">create_forward</a> <a href="#M000106">create_reply</a> <a href="#M000036">date</a> <a href="#M000037">date=</a> <a href="#M000127">delete</a> <a href="#M000128">delete_if</a> <a href="#M000151">delete_no_send_fields</a> <a href="#M000100">destinations</a> <a href="#M000089">disposition</a> <a href="#M000092">disposition=</a> <a href="#M000145">disposition_is_attachment?</a> <a href="#M000095">disposition_param</a> <a href="#M000135">each</a> <a href="#M000102">each_dest</a> <a href="#M000101">each_destination</a> <a href="#M000123">each_field</a> <a href="#M000119">each_header</a> <a href="#M000121">each_header_name</a> <a href="#M000122">each_key</a> <a href="#M000120">each_pair</a> <a href="#M000144">each_part</a> <a href="#M000124">each_value</a> <a href="#M000085">encoding</a> <a href="#M000086">encoding=</a> <a href="#M000141">epilogue</a> <a href="#M000142">epilogue=</a> <a href="#M000104">error_reply_addresses</a> <a href="#M000116">fetch</a> <a href="#M000055">friendly_from</a> <a href="#M000053">from</a> <a href="#M000054">from=</a> <a href="#M000051">from_addrs</a> <a href="#M000052">from_addrs=</a> <a href="#M000032">has_attachments?</a> <a href="#M000113">header</a> <a href="#M000035">header_string</a> <a href="#M000069">in_reply_to</a> <a href="#M000070">in_reply_to=</a> <a href="#M000132">indexes</a> <a href="#M000133">indices</a> <a href="#M000110">inspect</a> <a href="#M000130">key?</a> <a href="#M000129">keys</a> <a href="#M000108">load</a> <a href="#M000076">main_type</a> <a href="#M000067">message_id</a> <a href="#M000068">message_id=</a> <a href="#M000154">mime_encode</a> <a href="#M000157">mime_encode_binary</a> <a href="#M000158">mime_encode_multipart</a> <a href="#M000155">mime_encode_singlepart</a> <a href="#M000156">mime_encode_text</a> <a href="#M000073">mime_version</a> <a href="#M000074">mime_version=</a> <a href="#M000105">multipart?</a> <a href="#M000125">ordered_each</a> <a href="#M000109">parse</a> <a href="#M000143">parts</a> <a href="#M000139">preamble</a> <a href="#M000140">preamble=</a> <a href="#M000136">quoted_body</a> <a href="#M000137">quoted_body=</a> <a href="#M000065">quoted_subject</a> <a href="#M000150">ready_to_send</a> <a href="#M000071">references</a> <a href="#M000072">references=</a> <a href="#M000103">reply_addresses</a> <a href="#M000058">reply_to</a> <a href="#M000059">reply_to=</a> <a href="#M000056">reply_to_addrs</a> <a href="#M000057">reply_to_addrs=</a> <a href="#M000148">send_text_to</a> <a href="#M000147">send_to</a> <a href="#M000149">send_to_0</a> <a href="#M000062">sender</a> <a href="#M000063">sender=</a> <a href="#M000060">sender_addr</a> <a href="#M000061">sender_addr=</a> <a href="#M000093">set_content_disposition</a> <a href="#M000078">set_content_type</a> <a href="#M000091">set_disposition</a> <a href="#M000118">store</a> <a href="#M000038">strftime</a> <a href="#M000115">sub_header</a> <a href="#M000077">sub_type</a> <a href="#M000064">subject</a> <a href="#M000159">subject</a> <a href="#M000066">subject=</a> <a href="#M000045">to</a> <a href="#M000048">to=</a> <a href="#M000039">to_addrs</a> <a href="#M000042">to_addrs=</a> <a href="#M000083">transfer_encoding</a> <a href="#M000084">transfer_encoding=</a> <a href="#M000080">type_param</a> <a href="#M000160">unquoted_body</a> <a href="#M000131">values_at</a> <a href="#M000111">write_back</a> </div> </div> </div> <!-- if includes --> <div id="includes"> <h3 class="section-bar">Included Modules</h3> <div id="includes-list"> <span class="include-name">StrategyInterface</span> </div> </div> <div id="section"> <div id="constants-list"> <h3 class="section-bar">Constants</h3> <div class="name-list"> <table summary="Constants"> <tr class="top-aligned-row context-row"> <td class="context-item-name">ALLOW_MULTIPLE</td> <td>=</td> <td class="context-item-value">{ 'received' => true, 'resent-date' => true, 'resent-from' => true, 'resent-sender' => true, 'resent-to' => true, 'resent-cc' => true, 'resent-bcc' => true, 'resent-message-id' => true, 'comments' => true, 'keywords' => true</td> <td width="3em"> </td> <td class="context-item-desc"> <a href="Mail.html#M000113">header</a> </td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">USE_ARRAY</td> <td>=</td> <td class="context-item-value">ALLOW_MULTIPLE</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">FIELD_ORDER</td> <td>=</td> <td class="context-item-value">%w( return-path received resent-date resent-from resent-sender resent-to resent-cc resent-bcc resent-message-id date from sender reply-to to cc bcc message-id in-reply-to references subject comments keywords mime-version content-type content-transfer-encoding content-disposition content-description )</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">NOSEND_FIELDS</td> <td>=</td> <td class="context-item-value">%w( received bcc )</td> </tr> </table> </div> </div> <div id="aliases-list"> <h3 class="section-bar">External Aliases</h3> <div class="name-list"> <table summary="aliases"> <tr class="top-aligned-row context-row"> <td class="context-item-name">load</td> <td>-></td> <td class="context-item-value">load_from</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">load</td> <td>-></td> <td class="context-item-value">loadfrom</td> </tr> </table> </div> </div> <div id="attribute-list"> <h3 class="section-bar">Attributes</h3> <div class="name-list"> <table> <tr class="top-aligned-row context-row"> <td class="context-item-name">port</td> <td class="context-item-value"> [R] </td> <td class="context-item-desc"> Provides access <a href="Mail.html#M000045">to</a> the port this email is using <a href="Mail.html#M000045">to</a> hold it‘s data <p> Example: </p> <pre> mail = TMail::Mail.parse(email_string) mail.port #=> #<TMail::StringPort:id=0xa2c952> </pre> </td> </tr> </table> </div> </div> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Class methods</h3> <div id="method-M000108" class="method-detail"> <a name="M000108"></a> <div class="method-heading"> <a href="Mail.src/M000108.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000108.html');return false;"> <span class="method-name">load</span><span class="method-args">( fname )</span> </a> </div> <div class="method-description"> <p> Opens an email that has been saved out as a file by itself. </p> <p> This function will read a file non-destructively and then <a href="Mail.html#M000109">parse</a> the contents and return a <a href="Mail.html">TMail::Mail</a> object. </p> <p> Does not handle multiple email mailboxes (like a unix mbox) for that use the <a href="UNIXMbox.html">TMail::UNIXMbox</a> class. </p> <p> Example: </p> <pre> mail = TMail::Mail.load('filename') </pre> </div> </div> <div id="method-M000109" class="method-detail"> <a name="M000109"></a> <div class="method-heading"> <a href="Mail.src/M000109.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000109.html');return false;"> <span class="method-name">parse</span><span class="method-args">( str )</span> </a> </div> <div class="method-description"> <p> Parses an email <a href="Mail.html#M000053">from</a> the supplied string and returns a <a href="Mail.html">TMail::Mail</a> object. </p> <p> Example: </p> <pre> require 'rubygems'; require 'tmail' email_string =<<HEREDOC To: mikel@lindsaar.net From: mikel@me.com Subject: This is a short Email Hello there Mikel! HEREDOC mail = TMail::Mail.parse(email_string) #=> #<TMail::Mail port=#<TMail::StringPort:id=0xa30ac0> bodyport=nil> mail.body #=> "Hello there Mikel!\n\n" </pre> </div> </div> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000114" class="method-detail"> <a name="M000114"></a> <div class="method-heading"> <a href="Mail.src/M000114.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000114.html');return false;"> <span class="method-name">[]</span><span class="method-args">( key )</span> </a> </div> <div class="method-description"> <p> Returns a <a href="AddressHeader.html">TMail::AddressHeader</a> object of the field you are querying. Examples: </p> <pre> @mail['from'] #=> #<TMail::AddressHeader "mikel@test.com.au"> @mail['to'] #=> #<TMail::AddressHeader "mikel@test.com.au"> </pre> <p> You can get the string value of this by passing "to_s" <a href="Mail.html#M000045">to</a> the query: Example: </p> <pre> @mail['to'].to_s #=> "mikel@test.com.au" </pre> </div> </div> <div id="method-M000117" class="method-detail"> <a name="M000117"></a> <div class="method-heading"> <a href="Mail.src/M000117.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000117.html');return false;"> <span class="method-name">[]=</span><span class="method-args">( key, val )</span> </a> </div> <div class="method-description"> <p> Allows you <a href="Mail.html#M000045">to</a> set or <a href="Mail.html#M000127">delete</a> <a href="../TMail.html">TMail</a> <a href="Mail.html#M000113">header</a> objects at will. Examples: </p> <pre> @mail = TMail::Mail.new @mail['to'].to_s # => 'mikel@test.com.au' @mail['to'] = 'mikel@elsewhere.org' @mail['to'].to_s # => 'mikel@elsewhere.org' @mail.encoded # => "To: mikel@elsewhere.org\r\n\r\n" @mail['to'] = nil @mail['to'].to_s # => nil @mail.encoded # => "\r\n" </pre> <p> Note: setting mail[] = nil actually deletes the <a href="Mail.html#M000113">header</a> field in question <a href="Mail.html#M000053">from</a> the object, it does not just set the value of the hash <a href="Mail.html#M000045">to</a> nil </p> </div> </div> <div id="method-M000112" class="method-detail"> <a name="M000112"></a> <div class="method-heading"> <a href="Mail.src/M000112.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000112.html');return false;"> <span class="method-name">accept</span><span class="method-args">( strategy )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000153" class="method-detail"> <a name="M000153"></a> <div class="method-heading"> <a href="Mail.src/M000153.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000153.html');return false;"> <span class="method-name">add_date</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000152" class="method-detail"> <a name="M000152"></a> <div class="method-heading"> <a href="Mail.src/M000152.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000152.html');return false;"> <span class="method-name">add_message_id</span><span class="method-args">( fqdn = nil )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000033" class="method-detail"> <a name="M000033"></a> <div class="method-heading"> <a href="Mail.src/M000033.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000033.html');return false;"> <span class="method-name">attachment?</span><span class="method-args">(part)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000034" class="method-detail"> <a name="M000034"></a> <div class="method-heading"> <a href="Mail.src/M000034.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000034.html');return false;"> <span class="method-name">attachments</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000099" class="method-detail"> <a name="M000099"></a> <div class="method-heading"> <a href="Mail.src/M000099.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000099.html');return false;"> <span class="method-name">base64_decode</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns the result of decoding the <a href="Mail.html">TMail::Mail</a> object <a href="Mail.html#M000161">body</a> without altering the current <a href="Mail.html#M000161">body</a> </p> </div> </div> <div id="method-M000098" class="method-detail"> <a name="M000098"></a> <div class="method-heading"> <a href="Mail.src/M000098.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000098.html');return false;"> <span class="method-name">base64_decode!</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Convert the <a href="Mail.html">Mail</a> object‘s <a href="Mail.html#M000161">body</a> into a Base64 decoded email returning the modified <a href="Mail.html">Mail</a> object </p> </div> </div> <div id="method-M000097" class="method-detail"> <a name="M000097"></a> <div class="method-heading"> <a href="Mail.src/M000097.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000097.html');return false;"> <span class="method-name">base64_encode</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Return the result of <a href="Mail.html#M000085">encoding</a> the <a href="Mail.html">TMail::Mail</a> object <a href="Mail.html#M000161">body</a> without altering the current <a href="Mail.html#M000161">body</a> </p> </div> </div> <div id="method-M000096" class="method-detail"> <a name="M000096"></a> <div class="method-heading"> <a href="Mail.src/M000096.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000096.html');return false;"> <span class="method-name">base64_encode!</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Convert the <a href="Mail.html">Mail</a> object‘s <a href="Mail.html#M000161">body</a> into a Base64 encoded email returning the modified <a href="Mail.html">Mail</a> object </p> </div> </div> <div id="method-M000047" class="method-detail"> <a name="M000047"></a> <div class="method-heading"> <a href="Mail.src/M000047.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000047.html');return false;"> <span class="method-name">bcc</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns who the email <a href="Mail.html#M000047">bcc</a>‘d as an Array of email addresses as opposed <a href="Mail.html#M000045">to</a> an Array of <a href="Address.html">TMail::Address</a> objects which is what <a href="Mail.html#M000039">Mail#to_addrs</a> returns </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.bcc = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.bcc #=> ["mikel@me.org", "mikel@you.org"] </pre> </div> </div> <div id="method-M000050" class="method-detail"> <a name="M000050"></a> <div class="method-heading"> <a href="Mail.src/M000050.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000050.html');return false;"> <span class="method-name">bcc=</span><span class="method-args">( *strs )</span> </a> </div> <div class="method-description"> <p> Destructively sets the "Bcc:" field <a href="Mail.html#M000045">to</a> the passed array of strings (which should be valid email addresses) </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.bcc = ["mikel@abc.com", "Mikel <mikel@xyz.com>"] mail.bcc #=> ["mikel@abc.org", "mikel@xyz.org"] mail['bcc'].to_s #=> "mikel@abc.com, Mikel <mikel@xyz.com>" </pre> </div> </div> <div id="method-M000041" class="method-detail"> <a name="M000041"></a> <div class="method-heading"> <a href="Mail.src/M000041.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000041.html');return false;"> <span class="method-name">bcc_addrs</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Return a TMail::Addresses instance for <a href="Mail.html#M000135">each</a> entry in the "Bcc:" field of the mail object <a href="Mail.html#M000113">header</a>. </p> <p> If the "Bcc:" field does not exist, will return nil by default or the value you pass as the optional parameter. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.bcc_addrs #=> nil mail.bcc_addrs([]) #=> [] mail.bcc = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.bcc_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000044" class="method-detail"> <a name="M000044"></a> <div class="method-heading"> <a href="Mail.src/M000044.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000044.html');return false;"> <span class="method-name">bcc_addrs=</span><span class="method-args">( arg )</span> </a> </div> <div class="method-description"> <p> Destructively set the <a href="Mail.html#M000045">to</a> field of the "Bcc:" <a href="Mail.html#M000113">header</a> <a href="Mail.html#M000045">to</a> equal the passed in string. </p> <p> <a href="../TMail.html">TMail</a> will <a href="Mail.html#M000109">parse</a> your contents and turn <a href="Mail.html#M000135">each</a> valid email address into a <a href="Address.html">TMail::Address</a> object before assigning it <a href="Mail.html#M000045">to</a> the mail message. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.bcc = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.bcc_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000161" class="method-detail"> <a name="M000161"></a> <div class="method-heading"> <a href="Mail.src/M000161.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000161.html');return false;"> <span class="method-name">body</span><span class="method-args">(to_charset = 'utf-8', &block)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000138" class="method-detail"> <a name="M000138"></a> <div class="method-heading"> <a href="Mail.src/M000138.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000138.html');return false;"> <span class="method-name">body=</span><span class="method-args">( str )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000134" class="method-detail"> <a name="M000134"></a> <div class="method-heading"> <a href="Mail.src/M000134.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000134.html');return false;"> <span class="method-name">body_port</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> <a href="Mail.html#M000161">body</a> </p> </div> </div> <div id="method-M000046" class="method-detail"> <a name="M000046"></a> <div class="method-heading"> <a href="Mail.src/M000046.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000046.html');return false;"> <span class="method-name">cc</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns who the email <a href="Mail.html#M000046">cc</a>‘d as an Array of email addresses as opposed <a href="Mail.html#M000045">to</a> an Array of <a href="Address.html">TMail::Address</a> objects which is what <a href="Mail.html#M000039">Mail#to_addrs</a> returns </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.cc = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.cc #=> ["mikel@me.org", "mikel@you.org"] </pre> </div> </div> <div id="method-M000049" class="method-detail"> <a name="M000049"></a> <div class="method-heading"> <a href="Mail.src/M000049.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000049.html');return false;"> <span class="method-name">cc=</span><span class="method-args">( *strs )</span> </a> </div> <div class="method-description"> <p> Destructively sets the "Cc:" field <a href="Mail.html#M000045">to</a> the passed array of strings (which should be valid email addresses) </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.cc = ["mikel@abc.com", "Mikel <mikel@xyz.com>"] mail.cc #=> ["mikel@abc.org", "mikel@xyz.org"] mail['cc'].to_s #=> "mikel@abc.com, Mikel <mikel@xyz.com>" </pre> </div> </div> <div id="method-M000040" class="method-detail"> <a name="M000040"></a> <div class="method-heading"> <a href="Mail.src/M000040.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000040.html');return false;"> <span class="method-name">cc_addrs</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Return a TMail::Addresses instance for <a href="Mail.html#M000135">each</a> entry in the "Cc:" field of the mail object <a href="Mail.html#M000113">header</a>. </p> <p> If the "Cc:" field does not exist, will return nil by default or the value you pass as the optional parameter. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.cc_addrs #=> nil mail.cc_addrs([]) #=> [] mail.cc = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.cc_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000043" class="method-detail"> <a name="M000043"></a> <div class="method-heading"> <a href="Mail.src/M000043.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000043.html');return false;"> <span class="method-name">cc_addrs=</span><span class="method-args">( arg )</span> </a> </div> <div class="method-description"> <p> Destructively set the <a href="Mail.html#M000045">to</a> field of the "Cc:" <a href="Mail.html#M000113">header</a> <a href="Mail.html#M000045">to</a> equal the passed in string. </p> <p> <a href="../TMail.html">TMail</a> will <a href="Mail.html#M000109">parse</a> your contents and turn <a href="Mail.html#M000135">each</a> valid email address into a <a href="Address.html">TMail::Address</a> object before assigning it <a href="Mail.html#M000045">to</a> the mail message. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.cc = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.cc_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000081" class="method-detail"> <a name="M000081"></a> <div class="method-heading"> <a href="Mail.src/M000081.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000081.html');return false;"> <span class="method-name">charset</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the character set of the email. Returns nil if no <a href="Mail.html#M000085">encoding</a> set or returns whatever default you pass as a parameter - note passing the parameter does NOT change the mail object in any way. </p> <p> Example: </p> <pre> mail = TMail::Mail.load("path_to/utf8_email") mail.charset #=> "UTF-8" mail = TMail::Mail.new mail.charset #=> nil mail.charset("US-ASCII") #=> "US-ASCII" </pre> </div> </div> <div id="method-M000082" class="method-detail"> <a name="M000082"></a> <div class="method-heading"> <a href="Mail.src/M000082.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000082.html');return false;"> <span class="method-name">charset=</span><span class="method-args">( str )</span> </a> </div> <div class="method-description"> <p> Destructively sets the character set used by this mail object <a href="Mail.html#M000045">to</a> the passed string, you should note though that this does nothing <a href="Mail.html#M000045">to</a> the mail <a href="Mail.html#M000161">body</a>, just changes the <a href="Mail.html#M000113">header</a> value, you will need <a href="Mail.html#M000045">to</a> transliterate the <a href="Mail.html#M000161">body</a> as well <a href="Mail.html#M000045">to</a> match whatever you put in this <a href="Mail.html#M000113">header</a> value if you are changing character sets. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.charset #=> nil mail.charset = "UTF-8" mail.charset #=> "UTF-8" </pre> </div> </div> <div id="method-M000126" class="method-detail"> <a name="M000126"></a> <div class="method-heading"> <a href="Mail.src/M000126.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000126.html');return false;"> <span class="method-name">clear</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000090" class="method-detail"> <a name="M000090"></a> <div class="method-heading"> <span class="method-name">content_disposition</span><span class="method-args">( default = nil )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000089">disposition</a> </p> </div> </div> <div id="method-M000094" class="method-detail"> <a name="M000094"></a> <div class="method-heading"> <span class="method-name">content_disposition=</span><span class="method-args">( str, params = nil )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000091">set_disposition</a> </p> </div> </div> <div id="method-M000087" class="method-detail"> <a name="M000087"></a> <div class="method-heading"> <span class="method-name">content_transfer_encoding</span><span class="method-args">( default = nil )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000083">transfer_encoding</a> </p> </div> </div> <div id="method-M000088" class="method-detail"> <a name="M000088"></a> <div class="method-heading"> <span class="method-name">content_transfer_encoding=</span><span class="method-args">( str )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000083">transfer_encoding</a>= </p> </div> </div> <div id="method-M000075" class="method-detail"> <a name="M000075"></a> <div class="method-heading"> <a href="Mail.src/M000075.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000075.html');return false;"> <span class="method-name">content_type</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the current "Content-Type" of the mail instance. </p> <p> If the <a href="Mail.html#M000075">content_type</a> field does not exist, returns nil by default or you can pass in as the parameter for what you want the default value <a href="Mail.html#M000045">to</a> be. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.content_type #=> nil mail.content_type([]) #=> [] mail = TMail::Mail.load("../test/fixtures/raw_email") mail.content_type #=> "text/plain" </pre> </div> </div> <div id="method-M000079" class="method-detail"> <a name="M000079"></a> <div class="method-heading"> <span class="method-name">content_type=</span><span class="method-args">( str, sub = nil, param = nil )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000078">set_content_type</a> </p> </div> </div> <div id="method-M000146" class="method-detail"> <a name="M000146"></a> <div class="method-heading"> <a href="Mail.src/M000146.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000146.html');return false;"> <span class="method-name">content_type_is_text?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns true if this part‘s content main type is text, else returns false. By main type is meant "text/plain" is text. "text/html" is text </p> </div> </div> <div id="method-M000107" class="method-detail"> <a name="M000107"></a> <div class="method-heading"> <a href="Mail.src/M000107.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000107.html');return false;"> <span class="method-name">create_forward</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Creates a new email in reply <a href="Mail.html#M000045">to</a> self. Sets the In-Reply-To and References headers for you automagically. </p> <p> Example: </p> <pre> mail = TMail::Mail.load("my_email") forward_email = mail.create_forward forward_email.class #=> TMail::Mail forward_email.content_type #=> "multipart/mixed" forward_email.body #=> "Attachment: (unnamed)" forward_email.encoded #=> Returns the original email as a MIME attachment </pre> </div> </div> <div id="method-M000106" class="method-detail"> <a name="M000106"></a> <div class="method-heading"> <a href="Mail.src/M000106.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000106.html');return false;"> <span class="method-name">create_reply</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Creates a new email in reply <a href="Mail.html#M000045">to</a> self. Sets the In-Reply-To and References headers for you automagically. </p> <p> Example: </p> <pre> mail = TMail::Mail.load("my_email") reply_email = mail.create_reply reply_email.class #=> TMail::Mail reply_email.references #=> ["<d3b8cf8e49f04480850c28713a1f473e@lindsaar.net>"] reply_email.in_reply_to #=> ["<d3b8cf8e49f04480850c28713a1f473e@lindsaar.net>"] </pre> </div> </div> <div id="method-M000036" class="method-detail"> <a name="M000036"></a> <div class="method-heading"> <a href="Mail.src/M000036.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000036.html');return false;"> <span class="method-name">date</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the <a href="Mail.html#M000036">date</a> of the email message as per the "<a href="Mail.html#M000036">date</a>" <a href="Mail.html#M000113">header</a> value or returns nil by default (if no <a href="Mail.html#M000036">date</a> field exists). </p> <p> You can also pass whatever default you want into this method and it will return that instead of nil if there is no <a href="Mail.html#M000036">date</a> already set. </p> </div> </div> <div id="method-M000037" class="method-detail"> <a name="M000037"></a> <div class="method-heading"> <a href="Mail.src/M000037.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000037.html');return false;"> <span class="method-name">date=</span><span class="method-args">( time )</span> </a> </div> <div class="method-description"> <p> Destructively sets the <a href="Mail.html#M000036">date</a> of the mail object with the passed Time instance, returns a Time instance set <a href="Mail.html#M000045">to</a> the date/time of the mail </p> <p> Example: </p> <pre> now = Time.now mail.date = now mail.date #=> Sat Nov 03 18:47:50 +1100 2007 mail.date.class #=> Time </pre> </div> </div> <div id="method-M000127" class="method-detail"> <a name="M000127"></a> <div class="method-heading"> <a href="Mail.src/M000127.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000127.html');return false;"> <span class="method-name">delete</span><span class="method-args">( key )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000128" class="method-detail"> <a name="M000128"></a> <div class="method-heading"> <a href="Mail.src/M000128.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000128.html');return false;"> <span class="method-name">delete_if</span><span class="method-args">() {|key, v| ...}</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000151" class="method-detail"> <a name="M000151"></a> <div class="method-heading"> <a href="Mail.src/M000151.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000151.html');return false;"> <span class="method-name">delete_no_send_fields</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000100" class="method-detail"> <a name="M000100"></a> <div class="method-heading"> <a href="Mail.src/M000100.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000100.html');return false;"> <span class="method-name">destinations</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns an array of <a href="Mail.html#M000135">each</a> destination in the email message including <a href="Mail.html#M000045">to</a>: <a href="Mail.html#M000046">cc</a>: or <a href="Mail.html#M000047">bcc</a>: </p> <p> Example: </p> <pre> mail.to = "Mikel <mikel@lindsaar.net>" mail.cc = "Trans <t@t.com>" mail.bcc = "bob <bob@me.com>" mail.destinations #=> ["mikel@lindsaar.net", "t@t.com", "bob@me.com"] </pre> </div> </div> <div id="method-M000089" class="method-detail"> <a name="M000089"></a> <div class="method-heading"> <a href="Mail.src/M000089.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000089.html');return false;"> <span class="method-name">disposition</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the content-<a href="Mail.html#M000089">disposition</a> of the mail object, returns nil or the passed default value if given </p> <p> Example: </p> <pre> mail = TMail::Mail.load("path_to/raw_mail_with_attachment") mail.disposition #=> "attachment" mail = TMail::Mail.load("path_to/plain_simple_email") mail.disposition #=> nil mail.disposition(false) #=> false </pre> </div> </div> <div id="method-M000092" class="method-detail"> <a name="M000092"></a> <div class="method-heading"> <span class="method-name">disposition=</span><span class="method-args">( str, params = nil )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000091">set_disposition</a> </p> </div> </div> <div id="method-M000145" class="method-detail"> <a name="M000145"></a> <div class="method-heading"> <a href="Mail.src/M000145.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000145.html');return false;"> <span class="method-name">disposition_is_attachment?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns true if the content type of this part of the email is a <a href="Mail.html#M000089">disposition</a> attachment </p> </div> </div> <div id="method-M000095" class="method-detail"> <a name="M000095"></a> <div class="method-heading"> <a href="Mail.src/M000095.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000095.html');return false;"> <span class="method-name">disposition_param</span><span class="method-args">( name, default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the value of a parameter in an existing content-<a href="Mail.html#M000089">disposition</a> <a href="Mail.html#M000113">header</a> </p> <p> Example: </p> <pre> mail.set_disposition("attachment", {:filename => "test.rb"}) mail['content-disposition'].to_s #=> "attachment; filename=test.rb" mail.disposition_param("filename") #=> "test.rb" mail.disposition_param("missing_param_key") #=> nil mail.disposition_param("missing_param_key", false) #=> false mail.disposition_param("missing_param_key", "Nothing to see here") #=> "Nothing to see here" </pre> </div> </div> <div id="method-M000135" class="method-detail"> <a name="M000135"></a> <div class="method-heading"> <a href="Mail.src/M000135.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000135.html');return false;"> <span class="method-name">each</span><span class="method-args">( &block )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000102" class="method-detail"> <a name="M000102"></a> <div class="method-heading"> <span class="method-name">each_dest</span><span class="method-args">( &block )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000101">each_destination</a> </p> </div> </div> <div id="method-M000101" class="method-detail"> <a name="M000101"></a> <div class="method-heading"> <a href="Mail.src/M000101.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000101.html');return false;"> <span class="method-name">each_destination</span><span class="method-args">( ) {|i| ...}</span> </a> </div> <div class="method-description"> <p> Yields a block of destination, yielding <a href="Mail.html#M000135">each</a> as a string. </p> <pre> (from the destinations example) mail.each_destination { |d| puts "#{d.class}: #{d}" } String: mikel@lindsaar.net String: t@t.com String: bob@me.com </pre> </div> </div> <div id="method-M000123" class="method-detail"> <a name="M000123"></a> <div class="method-heading"> <a href="Mail.src/M000123.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000123.html');return false;"> <span class="method-name">each_field</span><span class="method-args">( &block )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000119" class="method-detail"> <a name="M000119"></a> <div class="method-heading"> <a href="Mail.src/M000119.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000119.html');return false;"> <span class="method-name">each_header</span><span class="method-args">() {|key, v| ...}</span> </a> </div> <div class="method-description"> <p> Allows you <a href="Mail.html#M000045">to</a> loop through <a href="Mail.html#M000135">each</a> <a href="Mail.html#M000113">header</a> in the <a href="Mail.html">TMail::Mail</a> object in a block Example: </p> <pre> @mail['to'] = 'mikel@elsewhere.org' @mail['from'] = 'me@me.com' @mail.each_header { |k,v| puts "#{k} = #{v}" } # => from = me@me.com # => to = mikel@elsewhere.org </pre> </div> </div> <div id="method-M000121" class="method-detail"> <a name="M000121"></a> <div class="method-heading"> <a href="Mail.src/M000121.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000121.html');return false;"> <span class="method-name">each_header_name</span><span class="method-args">( &block )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000122" class="method-detail"> <a name="M000122"></a> <div class="method-heading"> <span class="method-name">each_key</span><span class="method-args">( &block )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000121">each_header_name</a> </p> </div> </div> <div id="method-M000120" class="method-detail"> <a name="M000120"></a> <div class="method-heading"> <span class="method-name">each_pair</span><span class="method-args">()</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000119">each_header</a> </p> </div> </div> <div id="method-M000144" class="method-detail"> <a name="M000144"></a> <div class="method-heading"> <a href="Mail.src/M000144.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000144.html');return false;"> <span class="method-name">each_part</span><span class="method-args">( &block )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000124" class="method-detail"> <a name="M000124"></a> <div class="method-heading"> <span class="method-name">each_value</span><span class="method-args">( &block )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000123">each_field</a> </p> </div> </div> <div id="method-M000085" class="method-detail"> <a name="M000085"></a> <div class="method-heading"> <span class="method-name">encoding</span><span class="method-args">( default = nil )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000083">transfer_encoding</a> </p> </div> </div> <div id="method-M000086" class="method-detail"> <a name="M000086"></a> <div class="method-heading"> <span class="method-name">encoding=</span><span class="method-args">( str )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000083">transfer_encoding</a>= </p> </div> </div> <div id="method-M000141" class="method-detail"> <a name="M000141"></a> <div class="method-heading"> <a href="Mail.src/M000141.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000141.html');return false;"> <span class="method-name">epilogue</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000142" class="method-detail"> <a name="M000142"></a> <div class="method-heading"> <a href="Mail.src/M000142.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000142.html');return false;"> <span class="method-name">epilogue=</span><span class="method-args">( str )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000104" class="method-detail"> <a name="M000104"></a> <div class="method-heading"> <a href="Mail.src/M000104.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000104.html');return false;"> <span class="method-name">error_reply_addresses</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the "<a href="Mail.html#M000062">sender</a>" field as an array -> useful <a href="Mail.html#M000045">to</a> find out who <a href="Mail.html#M000045">to</a> send an error email <a href="Mail.html#M000045">to</a>. </p> </div> </div> <div id="method-M000116" class="method-detail"> <a name="M000116"></a> <div class="method-heading"> <span class="method-name">fetch</span><span class="method-args">( key )</span> </div> <div class="method-description"> <p> Alias for #[] </p> </div> </div> <div id="method-M000055" class="method-detail"> <a name="M000055"></a> <div class="method-heading"> <a href="Mail.src/M000055.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000055.html');return false;"> <span class="method-name">friendly_from</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the "friendly" human readable part of the address </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.from = "Mikel Lindsaar <mikel@abc.com>" mail.friendly_from #=> "Mikel Lindsaar" </pre> </div> </div> <div id="method-M000053" class="method-detail"> <a name="M000053"></a> <div class="method-heading"> <a href="Mail.src/M000053.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000053.html');return false;"> <span class="method-name">from</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns who the email is <a href="Mail.html#M000053">from</a> as an Array of email address strings instead <a href="Mail.html#M000045">to</a> an Array of <a href="Address.html">TMail::Address</a> objects which is what <a href="Mail.html#M000051">Mail#from_addrs</a> returns </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.from = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.from #=> ["mikel@me.org", "mikel@you.org"] </pre> </div> </div> <div id="method-M000054" class="method-detail"> <a name="M000054"></a> <div class="method-heading"> <a href="Mail.src/M000054.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000054.html');return false;"> <span class="method-name">from=</span><span class="method-args">( *strs )</span> </a> </div> <div class="method-description"> <p> Destructively sets the "From:" field <a href="Mail.html#M000045">to</a> the passed array of strings (which should be valid email addresses) </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.from = ["mikel@abc.com", "Mikel <mikel@xyz.com>"] mail.from #=> ["mikel@abc.org", "mikel@xyz.org"] mail['from'].to_s #=> "mikel@abc.com, Mikel <mikel@xyz.com>" </pre> </div> </div> <div id="method-M000051" class="method-detail"> <a name="M000051"></a> <div class="method-heading"> <a href="Mail.src/M000051.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000051.html');return false;"> <span class="method-name">from_addrs</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Return a TMail::Addresses instance for <a href="Mail.html#M000135">each</a> entry in the "From:" field of the mail object <a href="Mail.html#M000113">header</a>. </p> <p> If the "From:" field does not exist, will return nil by default or the value you pass as the optional parameter. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.from_addrs #=> nil mail.from_addrs([]) #=> [] mail.from = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.from_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000052" class="method-detail"> <a name="M000052"></a> <div class="method-heading"> <a href="Mail.src/M000052.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000052.html');return false;"> <span class="method-name">from_addrs=</span><span class="method-args">( arg )</span> </a> </div> <div class="method-description"> <p> Destructively set the <a href="Mail.html#M000045">to</a> value of the "From:" <a href="Mail.html#M000113">header</a> <a href="Mail.html#M000045">to</a> equal the passed in string. </p> <p> <a href="../TMail.html">TMail</a> will <a href="Mail.html#M000109">parse</a> your contents and turn <a href="Mail.html#M000135">each</a> valid email address into a <a href="Address.html">TMail::Address</a> object before assigning it <a href="Mail.html#M000045">to</a> the mail message. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.from_addrs = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.from_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000032" class="method-detail"> <a name="M000032"></a> <div class="method-heading"> <a href="Mail.src/M000032.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000032.html');return false;"> <span class="method-name">has_attachments?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000113" class="method-detail"> <a name="M000113"></a> <div class="method-heading"> <a href="Mail.src/M000113.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000113.html');return false;"> <span class="method-name">header</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000035" class="method-detail"> <a name="M000035"></a> <div class="method-heading"> <a href="Mail.src/M000035.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000035.html');return false;"> <span class="method-name">header_string</span><span class="method-args">( name, default = nil )</span> </a> </div> <div class="method-description"> <p> Allows you <a href="Mail.html#M000045">to</a> query the mail object with a string <a href="Mail.html#M000045">to</a> get the contents of the field you want. </p> <p> Returns a string of the exact contents of the field </p> <pre> mail.from = "mikel <mikel@lindsaar.net>" mail.header_string("From") #=> "mikel <mikel@lindsaar.net>" </pre> </div> </div> <div id="method-M000069" class="method-detail"> <a name="M000069"></a> <div class="method-heading"> <a href="Mail.src/M000069.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000069.html');return false;"> <span class="method-name">in_reply_to</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the "In-Reply-To:" field contents as an array of this mail instance if it exists </p> <p> If the <a href="Mail.html#M000069">in_reply_to</a> field does not exist, returns nil by default or you can pass in as the parameter for what you want the default value <a href="Mail.html#M000045">to</a> be. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.in_reply_to #=> nil mail.in_reply_to([]) #=> [] TMail::Mail.load("../test/fixtures/raw_email_reply") mail.in_reply_to #=> ["<348F04F142D69C21-291E56D292BC@xxxx.net>"] </pre> </div> </div> <div id="method-M000070" class="method-detail"> <a name="M000070"></a> <div class="method-heading"> <a href="Mail.src/M000070.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000070.html');return false;"> <span class="method-name">in_reply_to=</span><span class="method-args">( *idstrs )</span> </a> </div> <div class="method-description"> <p> Destructively sets the value of the "In-Reply-To:" field of an email. </p> <p> Accepts an array of a single string of a message id </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.in_reply_to = ["<348F04F142D69C21-291E56D292BC@xxxx.net>"] mail.in_reply_to #=> ["<348F04F142D69C21-291E56D292BC@xxxx.net>"] </pre> </div> </div> <div id="method-M000132" class="method-detail"> <a name="M000132"></a> <div class="method-heading"> <span class="method-name">indexes</span><span class="method-args">( *args )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000131">values_at</a> </p> </div> </div> <div id="method-M000133" class="method-detail"> <a name="M000133"></a> <div class="method-heading"> <span class="method-name">indices</span><span class="method-args">( *args )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000131">values_at</a> </p> </div> </div> <div id="method-M000110" class="method-detail"> <a name="M000110"></a> <div class="method-heading"> <a href="Mail.src/M000110.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000110.html');return false;"> <span class="method-name">inspect</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000130" class="method-detail"> <a name="M000130"></a> <div class="method-heading"> <a href="Mail.src/M000130.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000130.html');return false;"> <span class="method-name">key?</span><span class="method-args">( key )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000129" class="method-detail"> <a name="M000129"></a> <div class="method-heading"> <a href="Mail.src/M000129.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000129.html');return false;"> <span class="method-name">keys</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000076" class="method-detail"> <a name="M000076"></a> <div class="method-heading"> <a href="Mail.src/M000076.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000076.html');return false;"> <span class="method-name">main_type</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the current main type of the "Content-Type" of the mail instance. </p> <p> If the <a href="Mail.html#M000075">content_type</a> field does not exist, returns nil by default or you can pass in as the parameter for what you want the default value <a href="Mail.html#M000045">to</a> be. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.main_type #=> nil mail.main_type([]) #=> [] mail = TMail::Mail.load("../test/fixtures/raw_email") mail.main_type #=> "text" </pre> </div> </div> <div id="method-M000067" class="method-detail"> <a name="M000067"></a> <div class="method-heading"> <a href="Mail.src/M000067.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000067.html');return false;"> <span class="method-name">message_id</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the message ID for this mail object instance. </p> <p> If the <a href="Mail.html#M000067">message_id</a> field does not exist, returns nil by default or you can pass in as the parameter for what you want the default value <a href="Mail.html#M000045">to</a> be. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.message_id #=> nil mail.message_id(TMail.new_message_id) #=> "<47404c5326d9c_2ad4fbb80161@baci.local.tmail>" mail.message_id = TMail.new_message_id mail.message_id #=> "<47404c5326d9c_2ad4fbb80161@baci.local.tmail>" </pre> </div> </div> <div id="method-M000068" class="method-detail"> <a name="M000068"></a> <div class="method-heading"> <a href="Mail.src/M000068.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000068.html');return false;"> <span class="method-name">message_id=</span><span class="method-args">( str )</span> </a> </div> <div class="method-description"> <p> Destructively sets the message ID of the mail object instance <a href="Mail.html#M000045">to</a> the passed in string </p> <p> Invalid message IDs are ignored (silently, unless configured otherwise) and result in a nil message ID. Left and right angle brackets are required. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.message_id = "<348F04F142D69C21-291E56D292BC@xxxx.net>" mail.message_id #=> "<348F04F142D69C21-291E56D292BC@xxxx.net>" mail.message_id = "this_is_my_badly_formatted_message_id" mail.message_id #=> nil </pre> </div> </div> <div id="method-M000154" class="method-detail"> <a name="M000154"></a> <div class="method-heading"> <a href="Mail.src/M000154.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000154.html');return false;"> <span class="method-name">mime_encode</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000157" class="method-detail"> <a name="M000157"></a> <div class="method-heading"> <a href="Mail.src/M000157.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000157.html');return false;"> <span class="method-name">mime_encode_binary</span><span class="method-args">( body )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000158" class="method-detail"> <a name="M000158"></a> <div class="method-heading"> <a href="Mail.src/M000158.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000158.html');return false;"> <span class="method-name">mime_encode_multipart</span><span class="method-args">( top = true )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000155" class="method-detail"> <a name="M000155"></a> <div class="method-heading"> <a href="Mail.src/M000155.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000155.html');return false;"> <span class="method-name">mime_encode_singlepart</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000156" class="method-detail"> <a name="M000156"></a> <div class="method-heading"> <a href="Mail.src/M000156.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000156.html');return false;"> <span class="method-name">mime_encode_text</span><span class="method-args">( body )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000073" class="method-detail"> <a name="M000073"></a> <div class="method-heading"> <a href="Mail.src/M000073.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000073.html');return false;"> <span class="method-name">mime_version</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the listed MIME version of this email <a href="Mail.html#M000053">from</a> the "Mime-Version:" <a href="Mail.html#M000113">header</a> field </p> <p> If the <a href="Mail.html#M000073">mime_version</a> field does not exist, returns nil by default or you can pass in as the parameter for what you want the default value <a href="Mail.html#M000045">to</a> be. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.mime_version #=> nil mail.mime_version([]) #=> [] mail = TMail::Mail.load("../test/fixtures/raw_email") mail.mime_version #=> "1.0" </pre> </div> </div> <div id="method-M000074" class="method-detail"> <a name="M000074"></a> <div class="method-heading"> <a href="Mail.src/M000074.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000074.html');return false;"> <span class="method-name">mime_version=</span><span class="method-args">( m, opt = nil )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000105" class="method-detail"> <a name="M000105"></a> <div class="method-heading"> <a href="Mail.src/M000105.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000105.html');return false;"> <span class="method-name">multipart?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> Returns true if the <a href="Mail.html">Mail</a> object is a multipart message </p> </div> </div> <div id="method-M000125" class="method-detail"> <a name="M000125"></a> <div class="method-heading"> <a href="Mail.src/M000125.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000125.html');return false;"> <span class="method-name">ordered_each</span><span class="method-args">() {|name, v| ...}</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000143" class="method-detail"> <a name="M000143"></a> <div class="method-heading"> <a href="Mail.src/M000143.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000143.html');return false;"> <span class="method-name">parts</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000139" class="method-detail"> <a name="M000139"></a> <div class="method-heading"> <span class="method-name">preamble</span><span class="method-args">()</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000136">quoted_body</a> </p> </div> </div> <div id="method-M000140" class="method-detail"> <a name="M000140"></a> <div class="method-heading"> <span class="method-name">preamble=</span><span class="method-args">(str)</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000136">quoted_body</a>= </p> </div> </div> <div id="method-M000136" class="method-detail"> <a name="M000136"></a> <div class="method-heading"> <a href="Mail.src/M000136.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000136.html');return false;"> <span class="method-name">quoted_body</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000137" class="method-detail"> <a name="M000137"></a> <div class="method-heading"> <a href="Mail.src/M000137.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000137.html');return false;"> <span class="method-name">quoted_body=</span><span class="method-args">(str)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000065" class="method-detail"> <a name="M000065"></a> <div class="method-heading"> <span class="method-name">quoted_subject</span><span class="method-args">( default = nil )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000064">subject</a> </p> </div> </div> <div id="method-M000150" class="method-detail"> <a name="M000150"></a> <div class="method-heading"> <a href="Mail.src/M000150.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000150.html');return false;"> <span class="method-name">ready_to_send</span><span class="method-args">()</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000071" class="method-detail"> <a name="M000071"></a> <div class="method-heading"> <a href="Mail.src/M000071.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000071.html');return false;"> <span class="method-name">references</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the <a href="Mail.html#M000071">references</a> of this email (prior messages relating <a href="Mail.html#M000045">to</a> this message) as an array of message ID strings. Useful when you are trying <a href="Mail.html#M000045">to</a> thread an email. </p> <p> If the <a href="Mail.html#M000071">references</a> field does not exist, returns nil by default or you can pass in as the parameter for what you want the default value <a href="Mail.html#M000045">to</a> be. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.references #=> nil mail.references([]) #=> [] mail = TMail::Mail.load("../test/fixtures/raw_email_reply") mail.references #=> ["<473FF3B8.9020707@xxx.org>", "<348F04F142D69C21-291E56D292BC@xxxx.net>"] </pre> </div> </div> <div id="method-M000072" class="method-detail"> <a name="M000072"></a> <div class="method-heading"> <a href="Mail.src/M000072.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000072.html');return false;"> <span class="method-name">references=</span><span class="method-args">( *strs )</span> </a> </div> <div class="method-description"> <p> Destructively sets the value of the "References:" field of an email. </p> <p> Accepts an array of strings of message IDs </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.references = ["<348F04F142D69C21-291E56D292BC@xxxx.net>"] mail.references #=> ["<348F04F142D69C21-291E56D292BC@xxxx.net>"] </pre> </div> </div> <div id="method-M000103" class="method-detail"> <a name="M000103"></a> <div class="method-heading"> <a href="Mail.src/M000103.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000103.html');return false;"> <span class="method-name">reply_addresses</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns an array of reply <a href="Mail.html#M000045">to</a> addresses that the <a href="Mail.html">Mail</a> object has, or if the <a href="Mail.html">Mail</a> message has no reply-<a href="Mail.html#M000045">to</a>, returns an array of the <a href="Mail.html">Mail</a> objects <a href="Mail.html#M000053">from</a> addresses. Else returns the default which can either be passed as a parameter or defaults <a href="Mail.html#M000045">to</a> nil </p> <p> Example: </p> <pre> mail.from = "Mikel <mikel@lindsaar.net>" mail.reply_to = nil mail.reply_addresses #=> [""] </pre> </div> </div> <div id="method-M000058" class="method-detail"> <a name="M000058"></a> <div class="method-heading"> <a href="Mail.src/M000058.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000058.html');return false;"> <span class="method-name">reply_to</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns who the email is <a href="Mail.html#M000053">from</a> as an Array of email address strings instead <a href="Mail.html#M000045">to</a> an Array of <a href="Address.html">TMail::Address</a> objects which is what <a href="Mail.html#M000056">Mail#reply_to_addrs</a> returns </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.reply_to = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.reply_to #=> ["mikel@me.org", "mikel@you.org"] </pre> </div> </div> <div id="method-M000059" class="method-detail"> <a name="M000059"></a> <div class="method-heading"> <a href="Mail.src/M000059.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000059.html');return false;"> <span class="method-name">reply_to=</span><span class="method-args">( *strs )</span> </a> </div> <div class="method-description"> <p> Destructively sets the "Reply-To:" field <a href="Mail.html#M000045">to</a> the passed array of strings (which should be valid email addresses) </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.reply_to = ["mikel@abc.com", "Mikel <mikel@xyz.com>"] mail.reply_to #=> ["mikel@abc.org", "mikel@xyz.org"] mail['reply_to'].to_s #=> "mikel@abc.com, Mikel <mikel@xyz.com>" </pre> </div> </div> <div id="method-M000056" class="method-detail"> <a name="M000056"></a> <div class="method-heading"> <a href="Mail.src/M000056.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000056.html');return false;"> <span class="method-name">reply_to_addrs</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Return a TMail::Addresses instance for <a href="Mail.html#M000135">each</a> entry in the "Reply-To:" field of the mail object <a href="Mail.html#M000113">header</a>. </p> <p> If the "Reply-To:" field does not exist, will return nil by default or the value you pass as the optional parameter. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.reply_to_addrs #=> nil mail.reply_to_addrs([]) #=> [] mail.reply_to = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.reply_to_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000057" class="method-detail"> <a name="M000057"></a> <div class="method-heading"> <a href="Mail.src/M000057.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000057.html');return false;"> <span class="method-name">reply_to_addrs=</span><span class="method-args">( arg )</span> </a> </div> <div class="method-description"> <p> Destructively set the <a href="Mail.html#M000045">to</a> value of the "Reply-To:" <a href="Mail.html#M000113">header</a> <a href="Mail.html#M000045">to</a> equal the passed in argument. </p> <p> <a href="../TMail.html">TMail</a> will <a href="Mail.html#M000109">parse</a> your contents and turn <a href="Mail.html#M000135">each</a> valid email address into a <a href="Address.html">TMail::Address</a> object before assigning it <a href="Mail.html#M000045">to</a> the mail message. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.reply_to_addrs = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.reply_to_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000148" class="method-detail"> <a name="M000148"></a> <div class="method-heading"> <a href="Mail.src/M000148.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000148.html');return false;"> <span class="method-name">send_text_to</span><span class="method-args">( smtp )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000147" class="method-detail"> <a name="M000147"></a> <div class="method-heading"> <a href="Mail.src/M000147.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000147.html');return false;"> <span class="method-name">send_to</span><span class="method-args">( smtp )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000149" class="method-detail"> <a name="M000149"></a> <div class="method-heading"> <a href="Mail.src/M000149.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000149.html');return false;"> <span class="method-name">send_to_0</span><span class="method-args">( smtp, from, to )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000062" class="method-detail"> <a name="M000062"></a> <div class="method-heading"> <a href="Mail.src/M000062.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000062.html');return false;"> <span class="method-name">sender</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns who the <a href="Mail.html#M000062">sender</a> of this mail is as string instead <a href="Mail.html#M000045">to</a> an Array of <a href="Address.html">TMail::Address</a> objects which is what <a href="Mail.html#M000060">Mail#sender_addr</a> returns </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.sender = "Mikel <mikel@me.org>" mail.sender #=> "mikel@me.org" </pre> </div> </div> <div id="method-M000063" class="method-detail"> <a name="M000063"></a> <div class="method-heading"> <a href="Mail.src/M000063.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000063.html');return false;"> <span class="method-name">sender=</span><span class="method-args">( str )</span> </a> </div> <div class="method-description"> <p> Destructively sets the "Sender:" field <a href="Mail.html#M000045">to</a> the passed string (which should be a valid email address) </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.sender = "mikel@abc.com" mail.sender #=> "mikel@abc.org" mail['sender'].to_s #=> "mikel@abc.com" </pre> </div> </div> <div id="method-M000060" class="method-detail"> <a name="M000060"></a> <div class="method-heading"> <a href="Mail.src/M000060.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000060.html');return false;"> <span class="method-name">sender_addr</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Return a TMail::Addresses instance of the "Sender:" field of the mail object <a href="Mail.html#M000113">header</a>. </p> <p> If the "Sender:" field does not exist, will return nil by default or the value you pass as the optional parameter. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.sender #=> nil mail.sender([]) #=> [] mail.sender = "Mikel <mikel@me.org>" mail.reply_to_addrs #=> [#<TMail::Address mikel@me.org>] </pre> </div> </div> <div id="method-M000061" class="method-detail"> <a name="M000061"></a> <div class="method-heading"> <a href="Mail.src/M000061.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000061.html');return false;"> <span class="method-name">sender_addr=</span><span class="method-args">( addr )</span> </a> </div> <div class="method-description"> <p> Destructively set the <a href="Mail.html#M000045">to</a> value of the "Sender:" <a href="Mail.html#M000113">header</a> <a href="Mail.html#M000045">to</a> equal the passed in argument. </p> <p> <a href="../TMail.html">TMail</a> will <a href="Mail.html#M000109">parse</a> your contents and turn <a href="Mail.html#M000135">each</a> valid email address into a <a href="Address.html">TMail::Address</a> object before assigning it <a href="Mail.html#M000045">to</a> the mail message. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.sender_addrs = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.sender_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000093" class="method-detail"> <a name="M000093"></a> <div class="method-heading"> <span class="method-name">set_content_disposition</span><span class="method-args">( str, params = nil )</span> </div> <div class="method-description"> <p> Alias for <a href="Mail.html#M000091">set_disposition</a> </p> </div> </div> <div id="method-M000078" class="method-detail"> <a name="M000078"></a> <div class="method-heading"> <a href="Mail.src/M000078.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000078.html');return false;"> <span class="method-name">set_content_type</span><span class="method-args">( str, sub = nil, param = nil )</span> </a> </div> <div class="method-description"> <p> Destructively sets the "Content-Type:" <a href="Mail.html#M000113">header</a> field of this mail object </p> <p> Allows you <a href="Mail.html#M000045">to</a> set the main type, sub type as well as parameters <a href="Mail.html#M000045">to</a> the field. The main type and sub type need <a href="Mail.html#M000045">to</a> be a string. </p> <p> The optional params hash can be passed with <a href="Mail.html#M000129">keys</a> as symbols and values as a string, or strings as <a href="Mail.html#M000129">keys</a> and values. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.set_content_type("text", "plain") mail.to_s #=> "Content-Type: text/plain\n\n" mail.set_content_type("text", "plain", {:charset => "EUC-KR", :format => "flowed"}) mail.to_s #=> "Content-Type: text/plain; charset=EUC-KR; format=flowed\n\n" mail.set_content_type("text", "plain", {"charset" => "EUC-KR", "format" => "flowed"}) mail.to_s #=> "Content-Type: text/plain; charset=EUC-KR; format=flowed\n\n" </pre> </div> </div> <div id="method-M000091" class="method-detail"> <a name="M000091"></a> <div class="method-heading"> <a href="Mail.src/M000091.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000091.html');return false;"> <span class="method-name">set_disposition</span><span class="method-args">( str, params = nil )</span> </a> </div> <div class="method-description"> <p> Allows you <a href="Mail.html#M000045">to</a> set the content-<a href="Mail.html#M000089">disposition</a> of the mail object. Accepts a type and a hash of parameters. </p> <p> Example: </p> <pre> mail.set_disposition("attachment", {:filename => "test.rb"}) mail.disposition #=> "attachment" mail['content-disposition'].to_s #=> "attachment; filename=test.rb" </pre> </div> </div> <div id="method-M000118" class="method-detail"> <a name="M000118"></a> <div class="method-heading"> <span class="method-name">store</span><span class="method-args">( key, val )</span> </div> <div class="method-description"> <p> Alias for #[]= </p> </div> </div> <div id="method-M000038" class="method-detail"> <a name="M000038"></a> <div class="method-heading"> <a href="Mail.src/M000038.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000038.html');return false;"> <span class="method-name">strftime</span><span class="method-args">( fmt, default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the time of the mail message formatted <a href="Mail.html#M000045">to</a> your taste using a <a href="Mail.html#M000038">strftime</a> format string. If no <a href="Mail.html#M000036">date</a> set returns nil by default or whatever value you pass as the second optional parameter. </p> <pre> time = Time.now # (on Nov 16 2007) mail.date = time mail.strftime("%D") #=> "11/16/07" </pre> </div> </div> <div id="method-M000115" class="method-detail"> <a name="M000115"></a> <div class="method-heading"> <a href="Mail.src/M000115.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000115.html');return false;"> <span class="method-name">sub_header</span><span class="method-args">(key, param)</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000077" class="method-detail"> <a name="M000077"></a> <div class="method-heading"> <a href="Mail.src/M000077.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000077.html');return false;"> <span class="method-name">sub_type</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the current sub type of the "Content-Type" of the mail instance. </p> <p> If the <a href="Mail.html#M000075">content_type</a> field does not exist, returns nil by default or you can pass in as the parameter for what you want the default value <a href="Mail.html#M000045">to</a> be. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.sub_type #=> nil mail.sub_type([]) #=> [] mail = TMail::Mail.load("../test/fixtures/raw_email") mail.sub_type #=> "plain" </pre> </div> </div> <div id="method-M000064" class="method-detail"> <a name="M000064"></a> <div class="method-heading"> <a href="Mail.src/M000064.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000064.html');return false;"> <span class="method-name">subject</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the <a href="Mail.html#M000064">subject</a> of the mail instance. </p> <p> If the <a href="Mail.html#M000064">subject</a> field does not exist, returns nil by default or you can pass in as the parameter for what you want the default value <a href="Mail.html#M000045">to</a> be. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.subject #=> nil mail.subject("") #=> "" mail.subject = "Hello" mail.subject #=> "Hello" </pre> </div> </div> <div id="method-M000159" class="method-detail"> <a name="M000159"></a> <div class="method-heading"> <a href="Mail.src/M000159.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000159.html');return false;"> <span class="method-name">subject</span><span class="method-args">(to_charset = 'utf-8')</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000066" class="method-detail"> <a name="M000066"></a> <div class="method-heading"> <a href="Mail.src/M000066.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000066.html');return false;"> <span class="method-name">subject=</span><span class="method-args">( str )</span> </a> </div> <div class="method-description"> <p> Destructively sets the passed string as the <a href="Mail.html#M000064">subject</a> of the mail message. </p> <p> Example </p> <pre> mail = TMail::Mail.new mail.subject #=> "This subject" mail.subject = "Another subject" mail.subject #=> "Another subject" </pre> </div> </div> <div id="method-M000045" class="method-detail"> <a name="M000045"></a> <div class="method-heading"> <a href="Mail.src/M000045.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000045.html');return false;"> <span class="method-name">to</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns who the email is <a href="Mail.html#M000045">to</a> as an Array of email addresses as opposed <a href="Mail.html#M000045">to</a> an Array of <a href="Address.html">TMail::Address</a> objects which is what <a href="Mail.html#M000039">Mail#to_addrs</a> returns </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.to = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.to #=> ["mikel@me.org", "mikel@you.org"] </pre> </div> </div> <div id="method-M000048" class="method-detail"> <a name="M000048"></a> <div class="method-heading"> <a href="Mail.src/M000048.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000048.html');return false;"> <span class="method-name">to=</span><span class="method-args">( *strs )</span> </a> </div> <div class="method-description"> <p> Destructively sets the "To:" field <a href="Mail.html#M000045">to</a> the passed array of strings (which should be valid email addresses) </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.to = ["mikel@abc.com", "Mikel <mikel@xyz.com>"] mail.to #=> ["mikel@abc.org", "mikel@xyz.org"] mail['to'].to_s #=> "mikel@abc.com, Mikel <mikel@xyz.com>" </pre> </div> </div> <div id="method-M000039" class="method-detail"> <a name="M000039"></a> <div class="method-heading"> <a href="Mail.src/M000039.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000039.html');return false;"> <span class="method-name">to_addrs</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Return a TMail::Addresses instance for <a href="Mail.html#M000135">each</a> entry in the "To:" field of the mail object <a href="Mail.html#M000113">header</a>. </p> <p> If the "To:" field does not exist, will return nil by default or the value you pass as the optional parameter. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.to_addrs #=> nil mail.to_addrs([]) #=> [] mail.to = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.to_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000042" class="method-detail"> <a name="M000042"></a> <div class="method-heading"> <a href="Mail.src/M000042.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000042.html');return false;"> <span class="method-name">to_addrs=</span><span class="method-args">( arg )</span> </a> </div> <div class="method-description"> <p> Destructively set the <a href="Mail.html#M000045">to</a> field of the "To:" <a href="Mail.html#M000113">header</a> <a href="Mail.html#M000045">to</a> equal the passed in string. </p> <p> <a href="../TMail.html">TMail</a> will <a href="Mail.html#M000109">parse</a> your contents and turn <a href="Mail.html#M000135">each</a> valid email address into a <a href="Address.html">TMail::Address</a> object before assigning it <a href="Mail.html#M000045">to</a> the mail message. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.to = "Mikel <mikel@me.org>, another Mikel <mikel@you.org>" mail.to_addrs #=> [#<TMail::Address mikel@me.org>, #<TMail::Address mikel@you.org>] </pre> </div> </div> <div id="method-M000083" class="method-detail"> <a name="M000083"></a> <div class="method-heading"> <a href="Mail.src/M000083.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000083.html');return false;"> <span class="method-name">transfer_encoding</span><span class="method-args">( default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the transfer <a href="Mail.html#M000085">encoding</a> of the email. Returns nil if no <a href="Mail.html#M000085">encoding</a> set or returns whatever default you pass as a parameter - note passing the parameter does NOT change the mail object in any way. </p> <p> Example: </p> <pre> mail = TMail::Mail.load("path_to/base64_encoded_email") mail.transfer_encoding #=> "base64" mail = TMail::Mail.new mail.transfer_encoding #=> nil mail.transfer_encoding("base64") #=> "base64" </pre> </div> </div> <div id="method-M000084" class="method-detail"> <a name="M000084"></a> <div class="method-heading"> <a href="Mail.src/M000084.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000084.html');return false;"> <span class="method-name">transfer_encoding=</span><span class="method-args">( str )</span> </a> </div> <div class="method-description"> <p> Destructively sets the transfer <a href="Mail.html#M000085">encoding</a> of the mail object <a href="Mail.html#M000045">to</a> the passed string, you should note though that this does nothing <a href="Mail.html#M000045">to</a> the mail <a href="Mail.html#M000161">body</a>, just changes the <a href="Mail.html#M000113">header</a> value, you will need <a href="Mail.html#M000045">to</a> encode or decode the <a href="Mail.html#M000161">body</a> as well <a href="Mail.html#M000045">to</a> match whatever you put in this <a href="Mail.html#M000113">header</a> value. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.transfer_encoding #=> nil mail.transfer_encoding = "base64" mail.transfer_encoding #=> "base64" </pre> </div> </div> <div id="method-M000080" class="method-detail"> <a name="M000080"></a> <div class="method-heading"> <a href="Mail.src/M000080.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000080.html');return false;"> <span class="method-name">type_param</span><span class="method-args">( name, default = nil )</span> </a> </div> <div class="method-description"> <p> Returns the named type parameter as a string, <a href="Mail.html#M000053">from</a> the "Content-Type:" <a href="Mail.html#M000113">header</a>. </p> <p> Example: </p> <pre> mail = TMail::Mail.new mail.type_param("charset") #=> nil mail.type_param("charset", []) #=> [] mail.set_content_type("text", "plain", {:charset => "EUC-KR", :format => "flowed"}) mail.type_param("charset") #=> "EUC-KR" mail.type_param("format") #=> "flowed" </pre> </div> </div> <div id="method-M000160" class="method-detail"> <a name="M000160"></a> <div class="method-heading"> <a href="Mail.src/M000160.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000160.html');return false;"> <span class="method-name">unquoted_body</span><span class="method-args">(to_charset = 'utf-8')</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000131" class="method-detail"> <a name="M000131"></a> <div class="method-heading"> <a href="Mail.src/M000131.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000131.html');return false;"> <span class="method-name">values_at</span><span class="method-args">( *args )</span> </a> </div> <div class="method-description"> </div> </div> <div id="method-M000111" class="method-detail"> <a name="M000111"></a> <div class="method-heading"> <a href="Mail.src/M000111.html" target="Code" class="method-signature" onclick="popupCode('Mail.src/M000111.html');return false;"> <span class="method-name">write_back</span><span class="method-args">( eol = "\n", charset = 'e' )</span> </a> </div> <div class="method-description"> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>