Agent-TCLI-Package-Net

 view release on metacpan or  search on metacpan

lib/Agent/TCLI/Package/Net/SMTP.pm  view on Meta::CPAN

    who is To, who CC and who BCC.
    The bottom line is: be careful how you construct your email message.
  type: Param
---
Agent::TCLI::Parameter:
  name: body
  help: the body of the email
  manual: >
    The textual part of hte email message, or the MIME content if so inclined.
  type: Param
---
Agent::TCLI::Parameter:
  name: subject
  aliases: subj
  help: the subject line
  manual: >
    The subject line for the message.
  type: Param
---
Agent::TCLI::Parameter:
  name: server
  default: localhost
  help: The SMTP server to use.
  manual: >
    The name or address of the mail server that will accept delivery or relay
    the mail message.
  type: Param
---
Agent::TCLI::Parameter:
  name: port
  help: Port SMTP server is listening on
  constraints:
    - UINT
  class: numeric
  default: 25
  manual: >
    Sometimes, SMTP servers are set to listen to other ports,
    in which case you need to set this parameter to the correct
    value to match your setup.
  type: Param
---
Agent::TCLI::Parameter:
  name: timeout
  constraints:
    - UINT
  class: numeric
  default: 30
  help: Timeout in seconds
  manual: >
    The timeout in seconds for the SMTP transaction. The default is 30 seconds.
  type: Param
---
Agent::TCLI::Parameter:
  name: textfile
  constraints:
    - ASCII
  help: A file of plain text for the message body.
  manual: >
    The textfile will be used as the message body for sending an email. It
    should not include headers. If the file cannot be found, the request will
    fail. Use Unix style path names.
  type: Param
---
Agent::TCLI::Parameter:
  name: msgfile
  constraints:
    - ASCII
  help: A file of plain text for the message body.
  manual: >
    The msgfile will be used as the entire message for sending an email. It
    should include headers. If the file cannot be found, the request will
    fail. Use Unix style path names. The to and from must still be defined,
    though they need not match what is in the msg.
  type: Param
---
Agent::TCLI::Command:
  name: smtp
  call_style: session
  command: tcli_smtp
  contexts:
    ROOT: smtp
  handler: establish_context
  help: smtp client to send mail
  manual: >
    Send mail to aSMTP server
  topic: net
  usage: smtp send to=joe@example.com from=jane@example.com subject=Hi body="hi"
---
Agent::TCLI::Command:
  name: send
  call_style: session
  command: tcli_smtp
  contexts:
    smtp: send
  handler: send
  help: send a mail message
  manual: >
    Send mail to a SMTP server. There are many parameters that are required to
    properly construct the message.
  parameters:
    to:
    from:
    body:
    timeout:
    subject:
    server:
    port:
  required:
    to:
  topic: net
  usage: smtp send to=joe@example.com from=jane@example.com subject=Hi body="hi"
---
Agent::TCLI::Command:
  name: sendtext
  call_style: session
  command: tcli_smtp
  contexts:
    smtp: sendtext
  handler: send
  help: send a mail message
  manual: >
    Send mail to a SMTP server when the body is from a text file on the local
    host system.
  parameters:
    to:
    from:
    textfile:
    timeout:
    subject:
    server:
    port:
  required:
    to:
    textfile:
  topic: net
  usage: smtp sendtext to=joe@example.com from=jane@example.com subject=Hi textfile="/tmp/hello.txt"
---
Agent::TCLI::Command:
  name: sendmsg
  call_style: session
  command: tcli_smtp
  contexts:
    smtp: sendmsg
  handler: send
  help: send a mail message
  manual: >
    Send mail to a SMTP server when the body is from a text file on the local
    host system.
  parameters:
    to:
    from:
    msgfile:
    timeout:
    subject:
    server:
    port:
  required:
    to:
    msgfile:
  topic: net
  usage: smtp sendmsg to=joe@example.com msgfile="/tmp/hello.msg"
---
Agent::TCLI::Command:
  name: set
  call_style: session
  command: tcli_smtp
  contexts:
    smtp: set
  handler: settings
  help: set defaults for smtp messages
  parameters:
    to:
    from:
    body:
    timeout:
    subject:
    server:
    port:
  topic: network
  usage: smtp set server=mx.example.com
---
Agent::TCLI::Command:
  name: show
  call_style: session
  command: tcli_smtp
  contexts:
    smtp: show
  handler: show
  help: show current settings
  parameters:
    to:
    from:
    body:
    timeout:
    subject:
    server:
    port:
  topic: network
  usage: smtp show timeout
...

}


sub _start {
	my ($kernel,  $self,  $session) =
      @_[KERNEL, OBJECT,   SESSION];
	$self->Verbose("_start: tcli http starting");

	# are we up before OIO has finished initializing object?
	if (!defined( $self->name ))
	{
		$kernel->yield('_start');
		return;
	}

	# There is only one command object per TCLI
    $kernel->alias_set($self->name);


	$self->Verbose(" Dump ".$self->dump(1),3 );

}

sub _stop {
    my ($kernel,  $self,) =
      @_[KERNEL, OBJECT,];
	$self->Verbose("_stop: ".$self->name." stopping",2);
}

sub SendMailSuccess {
	my ($kernel,  $self,  $request) =
      @_[KERNEL, OBJECT,      ARG0];

	$request->Respond($kernel,"OK", 200);
	return
}

sub SendMailFailure {
	my ($kernel,  $self,  $request, $fail) =
      @_[KERNEL, OBJECT,      ARG0,  ARG1];

    $request->Respond($kernel, "Failed: ".pp($fail),400);
	$self->Verbose( "SendMailFailed: ".pp($fail));



( run in 0.586 second using v1.01-cache-2.11-cpan-5837b0d9d2c )