Jump to navigation Jump to search
- ns_sendmail - Deliver a mail message using SMTP
- ns_sendmail to from subject body ?extraheaders? ?bcc?
- This command delivers a mail message using a simple SMTP client implementation.
- to and bcc are strings containing comma-separated lists of email addresses and will be supplied as the "RCPT TO" portion of the SMTP transaction. from will be used as the "MAIL FROM" portion of the SMTP transaction. By default, the following mail message's headers are constructed by ns_sendmail: To, From, Subject, Date. subject is used for the Subject header, and the system's current time is used for the Date: header. Additional headers can be supplied using the extraheaders ns_set, where the key is used as the header name and the value is used as the header value.
- Note: This implementation of an SMTP client is very primitive, not very flexible, does very little error checking, is not very robust as it does not handle SMTP failures by retrying, etc. A better choice would be to use the Tcllib smtp package.
- The SMTP server used for mail delivery is controlled through the server's configuration in the ns/parameters section. The following parameters are currently recognized:
- smtphost - the FQDN name or IP address of the server to connect to. Default is "localhost".
- mailhost - if smtphost is not defined or is an empty string, then the mailhost parameter is used.
- smtptimeout - timeout in seconds when interacting with the SMTP server. Default is 60 seconds.
- smtpport - TCP port used for connecting to the SMTP server. Default is 25.
# Send a simple message from firstname.lastname@example.org to email@example.com. ns_sendmail firstname.lastname@example.org email@example.com \ "Hello, world." "Hi, how are you?"