NAME

Mail::SpamCannibal::SMTPsend - simple mail transport agent

SYNOPSIS

use Mail::SpamCannibal::SMTPsend qw( getMXhosts sendmessage );

DESCRIPTION

Mail::SpamCannibal::SMTPsend provides a simple interface to send mail from the host system without relying on installed MTA's.

  • @mxhosts = getMXhosts($domain);

    This function accepts either a domain name or email address as its argument. It returns an array of MXhosts in "priority" order or an empty array on error.

    The function is used internally by "sendmessage" and is exported for convenience.

      input:	somedomain.com
    	   or	name@somedomain.com
    
      returns:	array of MX hostnames
    	   or	() on error

    If you wish to overide this internal call so that sendmessage will use designated host(s), such as your ISP, then use the code snippet below prior to calling sendmessage (do not import getMXhosts).

      *Mail::SpamCannibal::SMTPsend::getMXhosts = sub {
    	return qw(	mx1.designated.host.com
    			mx2.designated.host.com
    	);
      }
  • $rv = sendmessage($message,$to,$from);

    Send an email message.

      input:	$message,	# text
    		$to,		# name@host.com
    		$from,		# optional@otherhost.com
    		[optional] $fh	# message spool "from" file handle

    If from is omitted, the ENV{USER} is used. If the domain is omitted, the fully qualified domain name of the host is used.

    If the optional $fh is present, then sendmessage will use the Net::Cmd datasend and dataend methods to send and will spool all available data from $fh to the target.

      returns:	true on success
    		else false

DEPENDENCIES

Net::DNS::Codes
Net::DNS::ToolKit
Sys::Hostname::FQDN
Net::SMTP
Mail::SpamCannibal::ScriptSupport

EXPORT_OK

getMXhosts
sendmessage

COPYRIGHT

Copyright 2003 - 2007, Michael Robinton <michael@bizsystems.com>

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

AUTHOR

Michael Robinton <michael@bizsystems.com>