Rand Stats

Net::SMTP

zef:raku-community-modules

Actions Status

Net-SMTP

A pure Raku 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

AUTHOR

Andrew Egeler

Source can be located at: https://github.com/raku-community-modules/Net-SMTP . Comments and Pull Requests are welcome.

COPYRIGHT AND LICENSE

Copyright 2014 - 2021 Andrew Egeler

Copyright 2022 Raku Community

All files in this repository are licensed under the terms of Create Commons License; for details please see the LICENSE file