Module: TMail

Extended by:
TextUtils
Defined in:
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/net.rb,
actionmailer/lib/action_mailer/vendor/tmail.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mail.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/port.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/utils.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/base64.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/header.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/config.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/version.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/address.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/mailbox.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/quoting.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/obsolete.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb,
actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb

Overview

– Copyright © 1998-2003 Minero Aoki <aamine@loveruby.net>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note: Originally licensed under LGPL v2+. Using MIT license for Rails with permission of Minero Aoki. ++ :stopdoc:

Defined Under Namespace

Modules: Base64, MailFlags, StrategyInterface, TextUtils, VERSION Classes: AddDate, AddMessageId, Address, AddressGroup, AddressHeader, Attachment, Config, ContentDispositionHeader, ContentTransferEncodingHeader, ContentTypeHeader, DateTimeHeader, Decoder, DeleteFields, Encoder, EncryptedHeader, FilePort, HeaderField, KeywordsHeader, Mail, Maildir, MaildirPort, MessageIdHeader, MhMailbox, MhPort, MimeEncodeAuto, MimeEncodeMulti, MimeEncodeSingle, MimeVersionHeader, Parser, Port, ReceivedHeader, ReferencesHeader, ReturnPathHeader, SingleAddressHeader, StringPort, StructuredHeader, SyntaxError, TMailScanner, UNIXMbox, Unquoter, UnstructuredHeader

Constant Summary

DEFAULT_CONFIG =
Config.new(false)
DEFAULT_STRICT_CONFIG =
Config.new(true)
MhLoader =

MhMailbox

MhMailbox
MboxLoader =

UNIXMbox

UNIXMbox
MaildirLoader =

Maildir

Maildir

Constants included from TextUtils

TextUtils::ATOM_UNSAFE, TextUtils::CONTROL_CHAR, TextUtils::MESSAGE_ID, TextUtils::MIME_ENCODED, TextUtils::MONTH, TextUtils::NKF_FLAGS, TextUtils::PHRASE_UNSAFE, TextUtils::RFC2231_ENCODED, TextUtils::TOKEN_UNSAFE, TextUtils::WDAY, TextUtils::ZONESTR_TABLE

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from TextUtils

atom_safe?, decode_RFC2231, decode_params, join_domain, message_id?, mime_encoded?, quote_atom, quote_boundary, quote_phrase, quote_token, quote_unquoted_bencode, quote_unquoted_name, time2str, timezone_string_to_unixtime, to_kcode, token_safe?, unquote

Class Attribute Details

.KCODEObject

Returns the value of attribute KCODE



40
41
42
# File 'actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb', line 40

def KCODE
  @KCODE
end

Class Method Details

.new_boundaryObject Also known as: boundary

Provides a new email boundary to separate parts of the email. This is a random string based off the current time, so should be fairly unique.

For Example:

TMail.new_boundary
#=> "mimepart_47bf656968207_25a8fbb80114"
TMail.new_boundary
#=> "mimepart_47bf66051de4_25a8fbb80240"


68
69
70
# File 'actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/utils.rb', line 68

def TMail.new_boundary
  'mimepart_' + random_tag
end

.new_message_id(fqdn = nil) ⇒ Object Also known as: msgid, new_msgid

Provides a new email message ID. You can use this to generate unique email message id's for your email so you can track them.

Optionally takes a fully qualified domain name (default to the current hostname returned by Socket.gethostname) that will be appended to the message ID.

For Example:

email.message_id = TMail.new_message_id
#=> "<47bf66845380e_25a8fbb80332@baci.local.tmail>"
email.to_s
#=> "Message-Id: <47bf668b633f1_25a8fbb80475@baci.local.tmail>\n\n"
email.message_id = TMail.new_message_id("lindsaar.net")
#=> "<47bf668b633f1_25a8fbb80475@lindsaar.net.tmail>"
email.to_s
#=> "Message-Id: <47bf668b633f1_25a8fbb80475@lindsaar.net.tmail>\n\n"


88
89
90
91
# File 'actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/utils.rb', line 88

def TMail.new_message_id( fqdn = nil )
  fqdn ||= ::Socket.gethostname
  "<#{random_tag()}@#{fqdn}.tmail>"
end

.random_tagObject

:stopdoc:



94
95
96
97
98
99
100
# File 'actionmailer/lib/action_mailer/vendor/tmail-1.2.7/tmail/utils.rb', line 94

def TMail.random_tag #:nodoc:
  @uniq += 1
  t = Time.now
  sprintf('%x%x_%x%x%d%x',
          t.to_i, t.tv_usec,
          $$, Thread.current.object_id, @uniq, rand(255))
end