Mail::sendmail(3) Send a mail via SMTP

SYNOPSIS

Void sendmail( String from, String whoto, [Pair<String, String> ] headers, String body, String server="localhost", Int port=25 )

ARGUMENTS

from The email address to send the message from

whoto The email address to send the message to

headers A list of name-value pairs for additional mail headers to send: consult RFC 2822 for further details.

body The body of the message.

server The hostname or IP address of the SMTP server (this is optional, and localhost will be used if it is not specified).

port The TCP port on the server to connect to (this is optional and the standard SMTP port of 25 will be used if it is not specified).

DESCRIPTION

Sends an email via SMTP as specified in the email.


 body = "..."; // text of message goes here
 headers = [("X-Mailer","Kaya"),
            ("Subject","Example Message"),
            ("Cc","[email protected]")];
 sendmail("[email protected]","[email protected]",headers,body);

The To , From and Date headers are set automatically and do not need adding to the headers array. Only the body parameter may contain newlines.

An Exception will be thrown if the header values are invalid, the SMTP server is unavailable, or the SMTP server rejects the message.

AUTHORS

Kaya standard library by Edwin Brady, Chris Morris and others ([email protected]). For further information see http://kayalang.org/

LICENSE

The Kaya standard library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (version 2.1 or any later version) as published by the Free Software Foundation.