Raku Land

Net::SMTP

P6-Net-SMTP

A pure-perl6 implementation of a SMTP client.

This module includes two different modes of operation: raw mode (sending raw SMTP commands), and a simple mode (just send this email!).

Example Usage

# raw interface
my $client = Net::SMTP.new(:server("your.server.here"), :port(587), :debug, :raw);
$client.get-response; # 220 your.server.here ...
$client.ehlo; # 250-STARTTLS\r\n250 ...
$client.mail-from('from@your.server.here'); # 250 OK
$client.rcpt-to('to@your.server.here'); # 250 OK
$client.data; # 354 Enter message
$client.payload($email); # 250 OK
$client.quit; # 221 closing connection

#simple interface
my $client = Net::SMTP.new(:server("your.server.here"), :port(587), :debug);
$client.auth($username, $password);
$client.send($from, @to, $message);
$client.send($message); # find From/To/CC/(BCC)? lines
$client.quit;

Simple mode methods

Note that all of these methods should return a true value on success or a Failure object if something goes wrong.

Raw mode methods

Installation and Tests

To install this module, please use zef from https://github.com/ugexe/zef and type

zef install Net::SMTP

or from a checkout of this source tree,

zef install .

You can run the test suite locally like this:

prove -e 'perl6 -Ilib' t/