[manual index][section index]


smtp - Simple Mail Transfer Protocol


include "smtp.m";
smtp := load Smtp Smtp->PATH;

open:     fn(server: string): (int, string);
sendmail: fn(fromwhom: string, 
             towhom: list of string, 
             cc: list of string,
             msg: list of string): (int, string);
close:    fn(): (int, string);


Smtp provides an interface to the mail transport protocol SMTP.

Open opens a connection to the given SMTP server. If server is nil, open uses the default mail server $smtp, which must be defined in ndb(6). It returns -1 and an error message if the connection fails.

Sendmail sends mail to the SMTP server for subsequent delivery. The first argument names the sender, the list towhom names the recipients, cc is a list of CC's, and msg has the text of the message. The latter may simply be a list of one item containing the whole message, a list of lines of the message or any intermediate format. It returns -1 and an error message on failure.

Close closes the connection to the SMTP server.




sendmail(1), acme(1)


Too much copying of strings is done, especially with large messages.

SMTP(2 ) Rev:  Tue Mar 31 02:42:39 GMT 2015