Difference between revisions of "Ns sendmail"

From AOLserver Wiki
Jump to navigation Jump to search
(imported from WiKit id 652)
 
(first stab at ns_sendmail doc)
Line 1: Line 1:
FGFG
+
{{manpage|ns_sendmail}}
 +
 
 +
----
 +
 
 +
'''NAME'''
 +
 
 +
: ns_sendmail - Deliver a mail message using SMTP
 +
 
 +
'''SYNOPSIS'''
 +
 
 +
: '''ns_sendmail''' ''to from subject body ?extraheaders? ?bcc?''
 +
 
 +
'''DESCRIPTION'''
 +
 
 +
: 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 [http://tcllib.sourceforge.net/doc/smtp.html Tcllib smtp] package.
 +
 
 +
'''CONFIGURATION'''
 +
 
 +
: 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.
 +
 
 +
'''EXAMPLES'''
 +
 
 +
    # Send a simple message from somebody@aolserver.com to nobody@aolserver.com.
 +
   
 +
    ns_sendmail nobody@aolserver.com somebody@aolserver.com \
 +
        "Hello, world." "Hi, how are you?"
 +
 
 +
'''SEE ALSO'''
 +
 
 +
: [[ns_param]], [[ns_section]], [[ns_set]], [[ns_sockopen]], [http://tcllib.sourceforge.net/doc/smtp.html Tcllib smtp]
 +
 
 +
[[Category:Core Tcl API]]

Revision as of 21:43, 12 October 2005

Man page: http://aolserver.com/man/4.0/tcl/ns_sendmail.html



NAME

ns_sendmail - Deliver a mail message using SMTP

SYNOPSIS

ns_sendmail to from subject body ?extraheaders? ?bcc?

DESCRIPTION

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.

CONFIGURATION

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.

EXAMPLES

   # Send a simple message from somebody@aolserver.com to nobody@aolserver.com.
    
   ns_sendmail nobody@aolserver.com somebody@aolserver.com \
       "Hello, world." "Hi, how are you?"

SEE ALSO

ns_param, ns_section, ns_set, ns_sockopen, Tcllib smtp