repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/bcc_field_spec.rb | spec/mail/fields/bcc_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::BccField do
# The "Bcc:" field (where the "Bcc" means "Blind Carbon Copy") contains
# addresses of recipients of the message whose addresses are not to be
# revealed to other recipients of the message. There a... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/from_field_spec.rb | spec/mail/fields/from_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
#
# from = "From:" mailbox-list CRLF
RSpec.describe Mail::FromField do
describe "initialization" do
it "should initialize" do
expect { Mail::FromField.new("Mikel") }.not_to raise_error
end
it "should accept a... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/resent_bcc_field_spec.rb | spec/mail/fields/resent_bcc_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
#
# resent-bcc = "Resent-Bcc:" (address-list / [CFWS]) CRLF
RSpec.describe Mail::ResentBccField do
describe "initialization" do
it "should initialize" do
expect { Mail::ResentBccField.new("Mikel") }.not_to raise_error
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/address_container_spec.rb | spec/mail/fields/address_container_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'AddressContainer' do
it "should allow you to append an address to an address field result" do
m = Mail.new("To: mikel@test.lindsaar.net")
expect(m.to).to eq ['mikel@test.lindsaar.net']
m.to << 'bob@test.lindsaar.net'
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/message_id_field_spec.rb | spec/mail/fields/message_id_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
# 3.6.4. Identification fields
#
# Though optional, every message SHOULD have a "Message-ID:" field.
# Furthermore, reply messages SHOULD have "In-Reply-To:" and
# "References:" fields as appropriate, as described below.
#
# The "Message-ID:"... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/resent_cc_field_spec.rb | spec/mail/fields/resent_cc_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
#
# resent-cc = "Resent-Cc:" address-list CRLF
RSpec.describe Mail::ResentCcField do
describe "initialization" do
it "should initialize" do
expect { Mail::ResentCcField.new("Mikel") }.not_to raise_error
end
it "s... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/received_field_spec.rb | spec/mail/fields/received_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ReceivedField do
it "should initialize" do
expect { Mail::ReceivedField.new("from localhost (localhost [127.0.0.1]) by xxx.xxxxx.com (Postfix) with ESMTP id 50FD3A96F for <xxxx@xxxx.com>; Tue, 10 May 2005 17:26:50 +0000 (... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/unstructured_field_spec.rb | spec/mail/fields/unstructured_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::UnstructuredField do
describe "initialization" do
it "should be instantiated" do
expect {Mail::UnstructuredField.new("Name", "Value")}.not_to raise_error
end
end
describe "manipulation" do
before(:ea... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/resent_from_field_spec.rb | spec/mail/fields/resent_from_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
#
# resent-from = "Resent-From:" mailbox-list CRLF
RSpec.describe Mail::ResentFromField do
describe "initialization" do
it "should initialize" do
expect { Mail::ResentFromField.new("Mikel") }.not_to raise_error
end
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/common_field_spec.rb | spec/mail/fields/common_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::CommonField do
describe "multi-charset support" do
it "should return '' on to_s if there is no value" do
expect(Mail::SubjectField.new(nil).to_s).to eq ''
end
it "should leave ascii alone" do
field =... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/structured_field_spec.rb | spec/mail/fields/structured_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::StructuredField do
describe "initialization" do
it "should be instantiated" do
expect {Mail::StructuredField.new("From", "bob@me.com")}.not_to raise_error
end
end
describe "manipulation" do
before(:e... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/content_id_field_spec.rb | spec/mail/fields/content_id_field_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ContentIdField do
# Content-ID Header Field
#
# In constructing a high-level user agent, it may be desirable to allow
# one body to make reference to another. Accordingly, bodies may be
# labelled using the "Content-ID" header field, w... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/return_path_field_spec.rb | spec/mail/fields/return_path_field_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ReturnPathField do
it "should allow you to specify a field" do
rp = Mail::ReturnPathField.new('mikel@test.lindsaar.net')
expect(rp.address).to eq 'mikel@test.lindsaar.net'
end
it "should encode the addr_spec in <>" do
rp = Mail... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/comments_field_spec.rb | spec/mail/fields/comments_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::CommentsField do
#
# comments = "Comments:" unstructured CRLF
it "should initialize" do
expect { Mail::CommentsField.new("this is a comment") }.not_to raise_error
end
it "should accept a string with... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/references_field_spec.rb | spec/mail/fields/references_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
#
# The "References:" field will contain the contents of the parent's
# "References:" field (if any) followed by the contents of the parent's
# "Message-ID:" field (if any). If the parent message does not contain
# a "References:" field ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/common_message_id_spec.rb | spec/mail/fields/common_message_id_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::CommonMessageIdField do
describe "encoding and decoding fields" do
it "should allow us to encode a message id field" do
field = Mail::MessageIdField.new('<ThisIsANonUniqueMessageId@me.com>')
expect(field.encoded).to eq "Messag... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/content_disposition_field_spec.rb | spec/mail/fields/content_disposition_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ContentDispositionField do
describe "initialization" do
it "should initialize" do
expect { Mail::ContentDispositionField.new("attachment; filename=File") }.not_to raise_error
end
it "should accept a string... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/resent_date_field_spec.rb | spec/mail/fields/resent_date_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ResentDateField do
it "should initialize" do
expect { Mail::ResentDateField.new("12 Aug 2009 00:00:02 GMT") }.not_to raise_error
end
it "should be able to tell the time" do
expect(Mail::ResentDateField.new("12 Aug... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/content_type_field_spec.rb | spec/mail/fields/content_type_field_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ContentTypeField do
# Content-Type Header Field
#
# The purpose of the Content-Type field is to describe the data
# contained in the body fully enough that the receiving user agent can
# pick an appropriate agent or mechanism to present... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/content_transfer_encoding_field_spec.rb | spec/mail/fields/content_transfer_encoding_field_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::ContentTransferEncodingField do
# Content-Transfer-Encoding Header Field
#
# Many media types which could be usefully transported via email are
# represented, in their "natural" format, as 8bit character or binary
# data. Such data ca... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/common_date_spec.rb | spec/mail/fields/common_date_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Mail::CommonDateField do
describe "encoding and decoding fields" do
it "should allow us to encode an date field" do
field = Mail::DateField.new('12 Aug 2009 00:00:02 GMT')
expect(field.encoded).to eq "Date: Wed, 12 Aug 2009 00:00:02 +... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/mail/fields/cc_field_spec.rb | spec/mail/fields/cc_field_spec.rb | # encoding: utf-8
# frozen_string_literal: true
require 'spec_helper'
# The "Cc:" field (where the "Cc" means "Carbon Copy" in the sense of
# making a copy on a typewriter using carbon paper) contains the
# addresses of others who are to receive the message, though the
# content of the message may not be d... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/spec/matchers/break_down_to.rb | spec/matchers/break_down_to.rb | # frozen_string_literal: true
module CustomMatchers
class BreakDownTo
def initialize(expected)
@expected = expected
end
def matches?(target)
@target = target
@failed = false
@expected.each_pair do |k,v|
@failed = k unless @target.send(k) == @expected[k]
end
!... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail.rb | lib/mail.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail # :doc:
require 'date'
require 'shellwords'
require 'uri'
require 'net/smtp'
require 'mini_mime'
require 'mail/version'
require 'mail/indifferent_hash'
require 'mail/multibyte'
require 'mail/constants'
require 'mail/utilities'
requi... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/version.rb | lib/mail/version.rb | # frozen_string_literal: true
module Mail
module VERSION
MAJOR = 2
MINOR = 9
PATCH = 0
BUILD = 'edge'
STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
def self.version
STRING
end
end
end
| ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/envelope.rb | lib/mail/envelope.rb | # encoding: utf-8
# frozen_string_literal: true
#
# = Mail Envelope
#
# The Envelope class provides a field for the first line in an
# mbox file, that looks like "From mikel@test.lindsaar.net DATETIME"
#
# This envelope class reads that line, and turns it into an
# Envelope.from and Envelope.date for your use.
module ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements.rb | lib/mail/elements.rb | # frozen_string_literal: true
module Mail
register_autoload :Address, 'mail/elements/address'
register_autoload :AddressList, 'mail/elements/address_list'
register_autoload :ContentDispositionElement, 'mail/elements/content_disposition_element'
register_autoload :ContentLocationElement, 'mail/elements/content_l... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network.rb | lib/mail/network.rb | # frozen_string_literal: true
require 'mail/network/retriever_methods/base'
module Mail
register_autoload :SMTP, 'mail/network/delivery_methods/smtp'
register_autoload :FileDelivery, 'mail/network/delivery_methods/file_delivery'
register_autoload :LoggerDelivery, 'mail/network/delivery_methods/logger_delivery'
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/smtp_envelope.rb | lib/mail/smtp_envelope.rb | # frozen_string_literal: true
module Mail
class SmtpEnvelope #:nodoc:
# Reasonable cap on address length to avoid SMTP line length
# overflow on old SMTP servers.
MAX_ADDRESS_BYTESIZE = 2000
attr_reader :from, :to, :message
def initialize(mail)
self.from = mail.smtp_envelope_from
se... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/encodings.rb | lib/mail/encodings.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
# Raised when attempting to decode an unknown encoding type
class UnknownEncodingType < StandardError #:nodoc:
end
module Encodings
include Mail::Constants
extend Mail::Utilities
@transfer_encodings = {}
# Register transfer encodin... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/field.rb | lib/mail/field.rb | # frozen_string_literal: true
require 'mail/fields'
require 'mail/constants'
# encoding: utf-8
module Mail
# Provides a single class to call to create a new structured or unstructured
# field. Works out per RFC what field of field it is being given and returns
# the correct field of class back on new.
#
# =... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/utilities.rb | lib/mail/utilities.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/constants'
require 'socket'
module Mail
module Utilities
extend self
# Returns true if the string supplied is free from characters not allowed as an ATOM
def atom_safe?( str )
not Constants::ATOM_UNSAFE === str
end
# If the str... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/yaml.rb | lib/mail/yaml.rb | require 'yaml'
module Mail
module YAML
def self.load(yaml)
permitted_classes = [
Symbol,
Mail::Body,
# Delivery methods as listed in mail/configuration.rb
Mail::SMTP,
Mail::Sendmail,
Mail::Exim,
Mail::FileDelivery,
Mail::SMTPConnection,
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/constants.rb | lib/mail/constants.rb | # encoding: us-ascii
# frozen_string_literal: true
module Mail
module Constants
white_space = %Q|\x9\x20|
text = %Q|\x1-\x8\xB\xC\xE-\x7f|
field_name = %Q|\x21-\x39\x3b-\x7e|
qp_safe = %Q|\x20-\x3c\x3e-\x7e|
aspecial = %Q|()<>[]:;@\\,."| # RFC5322
tspecial = %Q|()<>@,;:\\"... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/fields.rb | lib/mail/fields.rb | # frozen_string_literal: true
module Mail
register_autoload :CommonField, 'mail/fields/common_field'
register_autoload :CommonAddressField, 'mail/fields/common_address_field'
register_autoload :CommonMessageIdField, 'mail/fields/common_message_id_field'
register_autoload :CommonDateField, 'mail/fields/common_da... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/field_list.rb | lib/mail/field_list.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
# Field List class provides an enhanced array that keeps a list of
# email fields in order. And allows you to insert new fields without
# having to worry about the order they will appear in.
class FieldList < Array
def has_field?(field_name)
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parser_tools.rb | lib/mail/parser_tools.rb | module Mail
# Extends each field parser with utility methods.
module ParserTools #:nodoc:
# Slice bytes from ASCII-8BIT data and mark as UTF-8.
if 'string'.respond_to?(:force_encoding)
def chars(data, from_bytes, to_bytes)
data.slice(from_bytes..to_bytes).force_encoding(Encoding::UTF_8)
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parts_list.rb | lib/mail/parts_list.rb | # frozen_string_literal: true
require 'delegate'
module Mail
class PartsList < DelegateClass(Array)
attr_reader :parts
def initialize(*args)
@parts = Array.new(*args)
super @parts
end
# The #encode_with and #to_yaml methods are just implemented
# for the sake of backward compatibili... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/message.rb | lib/mail/message.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/constants'
require 'mail/utilities'
require 'mail/yaml'
module Mail
# The Message class provides a single point of access to all things to do with an
# email message.
#
# You create a new email message by calling the Mail::Message.new method, or jus... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | true |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/indifferent_hash.rb | lib/mail/indifferent_hash.rb | # encoding: utf-8
# frozen_string_literal: true
# This is an almost cut and paste from ActiveSupport v3.0.6, copied in here so that Mail
# itself does not depend on ActiveSupport to avoid versioning conflicts
module Mail
class IndifferentHash < Hash
def initialize(constructor = {})
if constructor.is_a?(H... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/configuration.rb | lib/mail/configuration.rb | # encoding: utf-8
# frozen_string_literal: true
#
# Thanks to Nicolas Fouché for this wrapper
#
require 'singleton'
module Mail
# The Configuration class is a Singleton used to hold the default
# configuration for all Mail objects.
#
# Each new mail object gets a copy of these values at initialization
# whi... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/attachments_list.rb | lib/mail/attachments_list.rb | # frozen_string_literal: true
module Mail
class AttachmentsList < Array
def initialize(parts_list)
@parts_list = parts_list
@content_disposition_type = 'attachment'
parts_list.map { |p|
if p.mime_type == 'message/rfc822'
parts = []
parts << p if p.attachment?
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/body.rb | lib/mail/body.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
# = Body
#
# The body is where the text of the email is stored. Mail treats the body
# as a single object. The body itself has no information about boundaries
# used in the MIME standard, it just looks at its content as either a single
# block o... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/mail.rb | lib/mail/mail.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
# Allows you to create a new Mail::Message object.
#
# You can make an email via passing a string or passing a block.
#
# For example, the following two examples will create the same email
# message:
#
# Creating via a string:
#
# string ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers.rb | lib/mail/parsers.rb | # frozen_string_literal: true
require 'mail/parsers/address_lists_parser'
require 'mail/parsers/content_disposition_parser'
require 'mail/parsers/content_location_parser'
require 'mail/parsers/content_transfer_encoding_parser'
require 'mail/parsers/content_type_parser'
require 'mail/parsers/date_time_parser'
require '... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/header.rb | lib/mail/header.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/constants'
require 'mail/utilities'
module Mail
# Provides access to a header object.
#
# ===Per RFC2822
#
# 2.2. Header Fields
#
# Header fields are lines composed of a field name, followed by a colon
# (":"), followed by a field body,... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/multibyte.rb | lib/mail/multibyte.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/multibyte/chars'
module Mail #:nodoc:
module Multibyte
# Raised when a problem with the encoding was found.
class EncodingError < StandardError; end
class << self
# The proxy class returned when calling mb_chars. You can use this access... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/part.rb | lib/mail/part.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/constants'
require 'mail/utilities'
module Mail
class Part < Message
# Creates a new empty Content-ID field and inserts it in the correct order
# into the Header. The ContentIdField object will automatically generate
# a unique content ID if ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/encodings/8bit.rb | lib/mail/encodings/8bit.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/encodings/binary'
module Mail
module Encodings
class EightBit < Binary
NAME = '8bit'
PRIORITY = 4
Encodings.register(NAME, self)
# Per RFC 2821 4.5.3.1, SMTP lines may not be longer than 1000 octets including the <CRLF>.
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/encodings/binary.rb | lib/mail/encodings/binary.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/encodings/identity'
module Mail
module Encodings
class Binary < Identity
NAME = 'binary'
PRIORITY = 5
Encodings.register(NAME, self)
end
end
end
| ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/encodings/7bit.rb | lib/mail/encodings/7bit.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/encodings/8bit'
module Mail
module Encodings
# 7bit and 8bit are equivalent. 7bit encoding is for text only.
class SevenBit < EightBit
NAME = '7bit'
PRIORITY = 1
Encodings.register(NAME, self)
def self.decode(str)
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/encodings/identity.rb | lib/mail/encodings/identity.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/encodings/transfer_encoding'
module Mail
module Encodings
# Identity encodings do no encoding/decoding and have a fixed cost:
# 1 byte in -> 1 byte out.
class Identity < TransferEncoding #:nodoc:
def self.decode(str)
str
en... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/encodings/unix_to_unix.rb | lib/mail/encodings/unix_to_unix.rb | # frozen_string_literal: true
module Mail
module Encodings
class UnixToUnix < TransferEncoding
NAME = "x-uuencode"
def self.decode(str)
str.sub(/\Abegin \d+ [^\n]*\n/, '').unpack1('u')
end
def self.encode(str)
[str].pack("u")
end
Encodings.register(NAME, self... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/encodings/transfer_encoding.rb | lib/mail/encodings/transfer_encoding.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
module Encodings
class TransferEncoding
NAME = ''
PRIORITY = -1
# And encoding's superclass can always transport it since the
# class hierarchy is arranged e.g. Base64 < 7bit < 8bit < Binary.
def self.can_transport?(enc)
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/encodings/base64.rb | lib/mail/encodings/base64.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/encodings/7bit'
module Mail
module Encodings
# Base64 encoding handles binary content at the cost of 4 output bytes
# per input byte.
class Base64 < SevenBit
NAME = 'base64'
PRIORITY = 3
Encodings.register(NAME, self)
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/encodings/quoted_printable.rb | lib/mail/encodings/quoted_printable.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/encodings/7bit'
module Mail
module Encodings
class QuotedPrintable < SevenBit
NAME='quoted-printable'
PRIORITY = 2
def self.can_encode?(enc)
EightBit.can_encode? enc
end
# Decode the string from Quoted-Printabl... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/multibyte/chars.rb | lib/mail/multibyte/chars.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/multibyte/unicode'
module Mail #:nodoc:
module Multibyte #:nodoc:
# Chars enables you to work transparently with UTF-8 encoding in the Ruby String class without having extensive
# knowledge about the encoding. A Chars object accepts a string upon ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/multibyte/utils.rb | lib/mail/multibyte/utils.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail #:nodoc:
module Multibyte #:nodoc:
# Returns a regular expression that matches valid characters in the current encoding
def self.valid_character
VALID_CHARACTER[Encoding.default_external.to_s]
end
# Returns true if string has valid ut... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/multibyte/unicode.rb | lib/mail/multibyte/unicode.rb | # frozen_string_literal: true
module Mail
module Multibyte
module Unicode
# Adapted from https://github.com/rails/rails/blob/master/activesupport/lib/active_support/multibyte/unicode.rb
# under the MIT license
# The Unicode version that is supported by the implementation
UNICODE_VERSION = ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/address_list.rb | lib/mail/elements/address_list.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/address_lists_parser'
module Mail
class AddressList #:nodoc:
attr_reader :addresses, :group_names
# Mail::AddressList is the class that parses To, From and other address fields from
# emails passed into Mail.
#
# AddressList p... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/phrase_list.rb | lib/mail/elements/phrase_list.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/phrase_lists_parser'
require 'mail/utilities'
module Mail
class PhraseList #:nodoc:
attr_reader :phrases
def initialize(string)
@phrases =
if Utilities.blank? string
[]
else
Mail::Parsers::PhraseL... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/message_ids_element.rb | lib/mail/elements/message_ids_element.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/message_ids_parser'
require 'mail/utilities'
module Mail
class MessageIdsElement #:nodoc:
def self.parse(string)
new(string).tap(&:message_ids)
end
attr_reader :message_ids
def initialize(string)
@message_ids = parse(... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/content_disposition_element.rb | lib/mail/elements/content_disposition_element.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/content_disposition_parser'
module Mail
class ContentDispositionElement #:nodoc:
attr_reader :disposition_type, :parameters
def initialize(string)
content_disposition = Mail::Parsers::ContentDispositionParser.parse(cleaned(string))
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/date_time_element.rb | lib/mail/elements/date_time_element.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/date_time_parser'
module Mail
class DateTimeElement #:nodoc:
attr_reader :date_string, :time_string
def initialize(string)
date_time = Mail::Parsers::DateTimeParser.parse(string)
@date_string = date_time.date_string
@tim... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/address.rb | lib/mail/elements/address.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/address_lists_parser'
require 'mail/constants'
require 'mail/utilities'
module Mail
# Mail::Address handles all email addresses in Mail. It takes an email address string
# and parses it, breaking it down into its component parts and allowing yo... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/mime_version_element.rb | lib/mail/elements/mime_version_element.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/mime_version_parser'
module Mail
class MimeVersionElement #:nodoc:
attr_reader :major, :minor
def initialize(string)
mime_version = Mail::Parsers::MimeVersionParser.parse(string)
@major = mime_version.major
@minor = mime... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/received_element.rb | lib/mail/elements/received_element.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/received_parser'
require 'mail/utilities'
require 'date'
module Mail
class ReceivedElement #:nodoc:
attr_reader :info, :date_time
def initialize(string)
if Utilities.blank? string
@date_time = nil
@info = nil
e... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/content_transfer_encoding_element.rb | lib/mail/elements/content_transfer_encoding_element.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/content_transfer_encoding_parser'
module Mail
class ContentTransferEncodingElement #:nodoc:
attr_reader :encoding
def initialize(string)
@encoding = Mail::Parsers::ContentTransferEncodingParser.parse(string).encoding
end
end
e... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/content_type_element.rb | lib/mail/elements/content_type_element.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/content_type_parser'
module Mail
class ContentTypeElement #:nodoc:
attr_reader :main_type, :sub_type, :parameters
def initialize(string)
content_type = Mail::Parsers::ContentTypeParser.parse(cleaned(string))
@main_type = conte... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/envelope_from_element.rb | lib/mail/elements/envelope_from_element.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/envelope_from_parser'
require 'date'
module Mail
class EnvelopeFromElement #:nodoc:
attr_reader :date_time, :address
def initialize(string)
envelope_from = Mail::Parsers::EnvelopeFromParser.parse(string)
@address = envelope_fr... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/elements/content_location_element.rb | lib/mail/elements/content_location_element.rb | # encoding: utf-8
# frozen_string_literal: true
require 'mail/parsers/content_location_parser'
module Mail
class ContentLocationElement #:nodoc:
attr_reader :location
def initialize(string)
@location = Mail::Parsers::ContentLocationParser.parse(string).location
end
def to_s(*args)
locat... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/matchers/has_sent_mail.rb | lib/mail/matchers/has_sent_mail.rb | # frozen_string_literal: true
module Mail
module Matchers
def have_sent_email
HasSentEmailMatcher.new(self)
end
class HasSentEmailMatcher
def initialize(_context)
end
def matches?(subject)
matching_deliveries = filter_matched_deliveries(Mail::TestMailer.deliveries)
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/matchers/attachment_matchers.rb | lib/mail/matchers/attachment_matchers.rb | # frozen_string_literal: true
module Mail
module Matchers
def any_attachment
AnyAttachmentMatcher.new
end
def an_attachment_with_filename(filename)
AttachmentFilenameMatcher.new(filename)
end
def an_attachment_with_mime_type(filename)
AttachmentMimeTypeMatcher.new(filename)
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/delivery_methods/exim.rb | lib/mail/network/delivery_methods/exim.rb | # frozen_string_literal: true
module Mail
# A delivery method implementation which sends via exim.
#
# To use this, first find out where the exim binary is on your computer,
# if you are on a mac or unix box, it is usually in /usr/sbin/exim, this will
# be your exim location.
#
# Mail.defaults do
# ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/delivery_methods/file_delivery.rb | lib/mail/network/delivery_methods/file_delivery.rb | # frozen_string_literal: true
require 'mail/smtp_envelope'
module Mail
# FileDelivery class delivers emails into multiple files based on the destination
# address. Each file is appended to if it already exists.
#
# So if you have an email going to fred@test, bob@test, joe@anothertest, and you
# set your loc... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/delivery_methods/smtp_connection.rb | lib/mail/network/delivery_methods/smtp_connection.rb | # frozen_string_literal: true
require 'mail/smtp_envelope'
module Mail
# == Sending Email with SMTP
#
# Mail allows you to send emails using an open SMTP connection. This is done by
# passing a created Net::SMTP object. This way we can get better performance to
# our local mail server by reducing the numbe... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/delivery_methods/logger_delivery.rb | lib/mail/network/delivery_methods/logger_delivery.rb | require 'mail/smtp_envelope'
module Mail
class LoggerDelivery
attr_reader :logger, :severity, :settings
def initialize(settings)
@settings = settings
@logger = settings.fetch(:logger) { default_logger }
@severity = derive_severity(settings[:severity])
end
def deliver!(mail)
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/delivery_methods/test_mailer.rb | lib/mail/network/delivery_methods/test_mailer.rb | # frozen_string_literal: true
require 'mail/smtp_envelope'
module Mail
# The TestMailer is a bare bones mailer that does nothing. It is useful
# when you are testing.
#
# It also provides a template of the minimum methods you require to implement
# if you want to make a custom mailer for Mail
class TestMa... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/delivery_methods/smtp.rb | lib/mail/network/delivery_methods/smtp.rb | # frozen_string_literal: true
require 'mail/smtp_envelope'
module Mail
# == Sending Email with SMTP
#
# Mail allows you to send emails using SMTP. This is done by wrapping Net::SMTP in
# an easy to use manner.
#
# === Sending via SMTP server on Localhost
#
# Sending locally (to a postfix or sendmail s... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/delivery_methods/sendmail.rb | lib/mail/network/delivery_methods/sendmail.rb | # frozen_string_literal: true
require 'mail/smtp_envelope'
module Mail
# A delivery method implementation which sends via sendmail.
#
# To use this, first find out where the sendmail binary is on your computer,
# if you are on a mac or unix box, it is usually in /usr/sbin/sendmail, this will
# be your sendma... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/retriever_methods/base.rb | lib/mail/network/retriever_methods/base.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
class Retriever
# Get the oldest received email(s)
#
# Possible options:
# count: number of emails to retrieve. The default value is 1.
# order: order of emails returned. Possible values are :asc or :desc. Default value is :asc.
... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/retriever_methods/pop3.rb | lib/mail/network/retriever_methods/pop3.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
# The Pop3 retriever allows to get the last, first or all emails from a POP3 server.
# Each email retrieved (RFC2822) is given as an instance of +Message+.
#
# While being retrieved, emails can be yielded if a block is given.
#
# === Example of re... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/retriever_methods/imap.rb | lib/mail/network/retriever_methods/imap.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
# The IMAP retriever allows to get the last, first or all emails from a IMAP server.
# Each email retrieved (RFC2822) is given as an instance of +Message+.
#
# While being retrieved, emails can be yielded if a block is given.
#
# === Example of re... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/network/retriever_methods/test_retriever.rb | lib/mail/network/retriever_methods/test_retriever.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
class TestRetriever < Retriever
def self.emails
@@emails
end
def self.emails=(val)
@@emails = val
end
def initialize(values)
@@emails = []
end
def find(options = nil, &block)
options = options ? Hash[... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/phrase_lists_parser.rb | lib/mail/parsers/phrase_lists_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
class PhraseListsParser
extend Mail::ParserTools
PhraseListsStruct = Struct.new(:phrases, :error)
class << self
attr_accessor :_t... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/date_time_parser.rb | lib/mail/parsers/date_time_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
module DateTimeParser
extend Mail::ParserTools
DateTimeStruct = Struct.new(:date_string, :time_string, :error)
class << self
attr... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/address_lists_parser.rb | lib/mail/parsers/address_lists_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
module AddressListsParser
extend Mail::ParserTools
AddressListStruct = Struct.new(:addresses, :group_names, :error)
AddressStruct = Struct... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | true |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/content_type_parser.rb | lib/mail/parsers/content_type_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
module ContentTypeParser
extend Mail::ParserTools
ContentTypeStruct = Struct.new(:main_type, :sub_type, :parameters, :error)
class << sel... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | true |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/mime_version_parser.rb | lib/mail/parsers/mime_version_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
module MimeVersionParser
extend Mail::ParserTools
MimeVersionStruct = Struct.new(:major, :minor, :error)
class << self
attr_acces... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/content_location_parser.rb | lib/mail/parsers/content_location_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
module ContentLocationParser
extend Mail::ParserTools
ContentLocationStruct = Struct.new(:location, :error)
class << self
attr_ac... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/content_transfer_encoding_parser.rb | lib/mail/parsers/content_transfer_encoding_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
module ContentTransferEncodingParser
extend Mail::ParserTools
ContentTransferEncodingStruct = Struct.new(:encoding, :error)
class << self... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/message_ids_parser.rb | lib/mail/parsers/message_ids_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
module MessageIdsParser
extend Mail::ParserTools
MessageIdsStruct = Struct.new(:message_ids, :error)
class << self
attr_accessor ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | true |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/received_parser.rb | lib/mail/parsers/received_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
module ReceivedParser
extend Mail::ParserTools
ReceivedStruct = Struct.new(:date, :time, :info, :error)
class << self
attr_access... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | true |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/content_disposition_parser.rb | lib/mail/parsers/content_disposition_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
module ContentDispositionParser
extend Mail::ParserTools
ContentDispositionStruct = Struct.new(:disposition_type, :parameters, :error)
cl... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/parsers/envelope_from_parser.rb | lib/mail/parsers/envelope_from_parser.rb | # frozen_string_literal: true
require "mail/utilities"
require "mail/parser_tools"
begin
original_verbose, $VERBOSE = $VERBOSE, nil
module Mail::Parsers
module EnvelopeFromParser
extend Mail::ParserTools
EnvelopeFromStruct = Struct.new(:address, :ctime_date, :error)
class << self
a... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | true |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/fields/common_address_field.rb | lib/mail/fields/common_address_field.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
class AddressContainer < Array #:nodoc:
def initialize(field, list = nil)
@field = field
super list if list
end
def <<(address)
@field << address
end
end
class CommonAddressField < NamedStructuredField #:nodoc:
de... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/fields/content_description_field.rb | lib/mail/fields/content_description_field.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
class ContentDescriptionField < NamedUnstructuredField #:nodoc:
NAME = 'Content-Description'
def self.singular?
true
end
end
end
| ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/fields/resent_date_field.rb | lib/mail/fields/resent_date_field.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
#
# resent-date = "Resent-Date:" date-time CRLF
class ResentDateField < CommonDateField #:nodoc:
NAME = 'Resent-Date'
end
end
| ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/fields/resent_cc_field.rb | lib/mail/fields/resent_cc_field.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
# = Resent-Cc Field
#
# The Resent-Cc field inherits resent-cc StructuredField and handles the Resent-Cc: header
# field in the email.
#
# Sending resent_cc to a mail message will instantiate a Mail::Field object that
# has a ResentCcField as it... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
mikel/mail | https://github.com/mikel/mail/blob/d1d65b370b109b98e673a934e8b70a0c1f58cc59/lib/mail/fields/from_field.rb | lib/mail/fields/from_field.rb | # encoding: utf-8
# frozen_string_literal: true
module Mail
# = From Field
#
# The From field inherits from StructuredField and handles the From: header
# field in the email.
#
# Sending from to a mail message will instantiate a Mail::Field object that
# has a FromField as its field type. This includes ... | ruby | MIT | d1d65b370b109b98e673a934e8b70a0c1f58cc59 | 2026-01-04T15:49:43.011919Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.