MT::Mail - Movable Type mail sender


    use MT::Mail;
    my %head = ( To => 'foo@bar.com', Subject => 'My Subject' );
    my $body = 'This is the body of the message.';
    MT::Mail->send(\%head, $body)
        or die MT::Mail->errstr;


MT::Mail is the Movable Type mail-sending interface. It can send mail through sendmail (in several different default locations), through SMTP, or through a debugging interface that writes data to STDERR. You can set the method of sending mail through the mt.cfg file by changing the value for the MailTransfer setting to one of the following values: sendmail, smtp, or debug.

If you are using sendmail, MT::Mail::send looks for your sendmail program in any of the following locations: /usr/lib/sendmail, /usr/sbin/sendmail, and /usr/ucblib/sendmail. If your sendmail is at a different location, you can set it using the SendMailPath directive.

If you are using smtp, MT::Mail::send will by default use localhost as the SMTP server. You can change this by setting the SMTPServer directive.


MT::Mail->send(\%headers, $body)

Sends a mail message with the headers \%headers and the message body $body.

The keys and values in \%headers are passed directly in to the mail program or server, so you can use any valid mail header names as keys. If you need to supply a list of header values, specify the hash value as a reference to a list of the header values. For example:

    %headers = ( Bcc => [ 'foo@bar.com', 'baz@quux.com' ] );

If you wish the lines in $body to be wrapped, you should do this yourself; it will not be done by send.

On success, send returns true; on failure, it returns undef, and the error message is in MT::Mail->errstr.


Please see the MT manpage for author, copyright, and license information.