name: TolerantSmtpModule
class: autohit.call.modules.TolerantSmptModule

A tolerant smtp module. It will be somewhat forgiving of connection problems.

You must start() a session before you can send() anything. It assumes that anything you send is well-formed RFC822 in stream format (the MIMEMessageModule can do this for you).

Where start() begins a session, done() closes it. A complete transaction includes calls to start(), login(), sender() or senderrelay(), recipient() or recipientrelay(), send() or senduni(), and done(). It is possible to reuse, reset, or otherwise manipulate sessions, as long as SMTP rules are not broken. There are two convienence methods that will do the whole transaction string in one, easy call--mailit() and mailituni(). However, niether allow complex sender or recipient information.

It is safe to call done() at any time! Of course, it will invalidate any session.

method
"start"
parameters:
"address" (): Host address for SMTP server or relay.
"port" (OPTIONAL): Port number for server or relay. It will use the default if not given.
returns:
nothing
description:
Start an SMTP session by connecting to an SMTP server or relay.

method
"login"
parameters:
"hostname" (OPTIONAL): Hostname to use instead of the default, which is the FQDN for the local host.
returns:
nothing
description:
Login to the SMTP server or relay.

method
"sender"
parameters:
"address" (REQUIRED): Address of the the sender.
returns:
nothing
description:
Set the sender address. Subsequent calls will overwrite the value. The address should be a valid email address. It will fault if a session has not been started or has expired.

method
"addsenderrelay"
parameters:
"address" (REQUIRED): Address of a leg in the relay.
returns:
nothing
description:
Add sender relay leg method. It will start accumulating a sender relay path. You must call this at least once, if you are going to use senderrelay(). The first call should contain a complete email address at the root of the relay chain. The accumulation will be reset after done() or other connection ending event. It will fault if a session has not been started or has expired.

method
"senderrelay"
parameters:
none
returns:
nothing
description:
It will set the sender as the accumulated relay. You must have called addsenderrelay() at least once or you will get an error. It will fault if a session has not been started or has expired.

method
"recipient"
parameters:
"address" (REQUIRED): Address of the the recipient.
returns:
nothing
description:
Add a recipient address. Subsequent calls will overwrite the value. The address should be a valid email address. It will fault if a session has notb een started or has expired.

method
"addrecipientrelay"
parameters:
"address" (REQUIRED): Address of a leg in the relay.
returns:
nothing
description:
Add recipient relay leg method. It will start accumulating a recipeint relay path. You must call this at least once, if you are going to use recipientrelay(). The first call should contain a complete email address at the root of the relay chain. The accumulation will be reset after done() or other connection ending event. It will fault if a session has not been started or has expired.

method
"recipientrelay"
parameters:
none
returns:
nothing
description:
It will set the recipients to the accumulated relay. You must have called addrecipientrelay() at least once or you will get an error. It will fault if a session has not been started or has expired.

method
"send"
parameters:
"text" (REQUIRED): Text to send as a message.
returns:
SMTP response code (numeric) as a string.
description:
Send the message in the text. Returns the SMTP reply code. Remember, this text should be a well-formed RFC822 message. It will fault if a session has not been started or has expired.

method
"senduni"
parameters:
"uniobj" (REQUIRED): Universe object to send as a message.
returns:
SMTP response code (numeric) as a string.
description:
Send the message in the Universe object. Returns the SMTP reply code. Remember, this object should contain a well-formed RFC822 message. It will fault if a session has not been started or has expired.

method
"senduniscrub"
parameters:
"uniobj" (REQUIRED): Universe object to send as a message.
returns:
SMTP response code (numeric) as a string.
description:
Send the message in the Universe object. It will run it through a variable replacement before sending. It'll replace all variables in scope. Returns the SMTP reply code. Remember, this object should contain a well-formed RFC822 message. It will fault if a session has not been started or has expired.

method
"reset"
parameters:
none
returns:
nothing
description:
This will reset the session. The module will stay connected to the server, but all data is reset, all headers are dumped, and all states are forgotten. It is safe to call this as any time.

method
"mailit"
parameters:
"to" (REQUIRED): To address (rcpt).
"from" (REQUIRED): From address (mail).
"text" (REQUIRED): Text to send as the message.
"host" (REQUIRED): Host address for SMTP server or relay.
"port" (REQUIRED): Port number for server or relay. It will use the default if not given.
returns:
SMTP response ode (numeric) as a string.
description:
A complete transaction wrapped into a convenient method. If a session is not started, it will create one using the host and port parameters. If a session is already started, it will ignore the host and port parameters. It returns the SMTP reply code. Remember, this text should be a well-formed RFC822 message.

method
"mailituni"
parameters:
"to" (REQUIRED): To address (rcpt).
"from" (REQUIRED): From address (mail).
"uniobj" (REQUIRED): Universe object to send.
"host" (REQUIRED): Host address for SMTP server or relay.
"port" (REQUIRED): Port number for server or relay. It will use the default if not given.
returns:
SMTP response code (numeric) as a string.
description:
A complete transaction wrapped into a convenient method. If a session is not started, it will create one using the host and port parameters. If a session is already started, it will ignore the host and port parameters. It returns the SMTP reply code. Remember, the universe object should contain a well-formed RFC822 message.

method
"done"
parameters:
none
returns:
nothing
description:

This will end a session. It is safe to call done() at any time! Of course, it will invalidate any session.

AUTOHIT 2003
MODULES DOCUMENTATION
Copyright Erich P Gatejen (c) 1989,1997,2003,2004
See license for details.