.\" This man page is automatically generated using .\" kayadoc2man from the Kaya development tools and the -xmldocs compile .\" option. Editing it directly is not encouraged. .\" It is under the same license as the source .k file that it was .\" generated from. .TH "Mail.sendmail" "3kaya" "August 2014" "Kaya" "Kaya module reference" .SH "NAME" Mail::sendmail \- Send a mail via SMTP .SH "SYNOPSIS" .B Void sendmail( \fIString from, String whoto, [Pair ] headers, String body, String server="localhost", Int port=25\fP .B ")" .SH "ARGUMENTS" .PP .B "from" The email address to send the message from .PP .B "whoto" The email address to send the message to .PP .B "headers" A list of name-value pairs for additional mail headers to send: consult RFC 2822 for further details. .PP .B "body" The body of the message. .PP .B "server" The hostname or IP address of the SMTP server (this is optional, and \fBlocalhost \fP will be used if it is not specified). .PP .B "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). .SH "DESCRIPTION" .PP Sends an email via SMTP as specified in the email. .IP "" -4 body = "..."; // text of message goes here headers = [("X-Mailer","Kaya"), ("Subject","Example Message"), ("Cc","example2@kayalang.org")]; sendmail("kaya@kayalang.org","example1@kayalang.org",headers,body); .PP The \fBTo \fP , \fBFrom \fP and \fBDate \fP headers are set automatically and do not need adding to the headers array. Only the body parameter may contain newlines. .PP An Exception will be thrown if the header values are invalid, the SMTP server is unavailable, or the SMTP server rejects the message. .SH "AUTHORS" Kaya standard library by Edwin Brady, Chris Morris and others (kaya@kayalang.org). For further information see http://kayalang.org/ .SH 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.