Tom Molesworth

NAME

Protocol::SMTP::Client - abstract client support for mail sending

VERSION

version 0.002

DESCRIPTION

Provides a client implementation for interacting with SMTP servers.

METHODS

new

Instantiates an SMTP client instance.

Takes no parameters.

auth_mechanism_override

Set this on instantiation to pick a specific auth method.

login

Attempts to log in to the server. Takes the following named parameters:

  • user - the username we're logging in with, might be your email address or a plain username

  • pass - used for password-based auth mechanisms such as PLAIN or MD5

Note that other auth mechanisms may provide additional fields - this will mostly be determined by how Authen::SASL deals with the authentication process.

Returns a Future which resolves once login completes or fails.

send

Attempts to send the given email.

Expects the following named parameters:

  • to - single email address or arrayref of recipients

  • from - envelope sender

  • data - the email content itself, currently needs to be 8BITMIME encoded, please raise an RT if other formats are required.

  • content - the email as a Perl Unicode string, this is mutually exclusive with the data parameter

Returns a Future which will resolve when the send is complete.

INTERNAL METHODS

The following are used internally. They are not likely to be of much use to client code, but may need to be called by implementations. See Net::Async::SMTP for a reference.

new_future

Instantiates a new Future. Sometimes implementations may want a Future subclass which knows how to get. Defaults to Future.

debug_printf

Used internally for debugging, returns an empty list.

write

Uses the configured writer to send data to the remote.

have_active_task

Returns true if we're partway through processing something.

write_line

Frames a line appropriately for sending to a remote.

body_encoding

Body encoding, currently hardcoded as 8BITMIME.

send_mail

Sequence of writes to send email to the remote. Normally you wouldn't use this directly, it'd be queued as a task by "send".

check_next_task

Called internally to check whether we have any other tasks we could be doing.

has_feature

Returns true if we have the given feature.

remote_feature

Marks the given feature from EHLO response as supported.

Also applies AUTH values.

auth_methods

Internal accessor, returns the list of defined authentication methods.

send_greeting

Sends the EHLO greeting and handles the resulting feature list.

starttls

Switch to TLS mode.

startup

Get initial startup banner.

wait_for

Waits for the given status code.

If we get something else, will mark as a failure.

handle_line

Handle input line from remote.

add_task

Add another task to the queue.

AUTHOR

Tom Molesworth <cpan@entitymodel.com>

LICENSE

Copyright Tom Molesworth 2012-2014. Licensed under the same terms as Perl itself.