Module index

source download

Module: smtp.lsp

Send mail using SMTP protocol

Version: 2.0 - March 2008, Cormullion added AUTH PLAIN authentication
Version: 2.1 - changes for 10.0
Version: 2.2 - doc changes
Version: 2.3 - fix in mail-send-body, thanks to Alessandro
Version: 2.31 - removed spurious apostrophe
Author: Lutz Mueller 2001-2010, Cormullion 2008

Routines for sending mail

This module implements routines to communicate with a SMTP mail server for sending email. To use this module include the following load statement at the beginning of the program file:
 (load "/usr/share/newlisp/modules/smtp.lsp") 
 ; or shorter
 (module "smtp.lsp")
To see debugging information:

(set 'debug-flag true)



syntax: (SMTP:send-mail str-from str-to str-subject str-message str-serveri [str-usr str-pass>]])
parameter: str-from - The email address of the sender.
parameter: str-to - The email address of the recipient.
parameter: str-subject - The subject line of the email.
parameter: str-message - The message part of the email.
parameter: str-server - The address of the SMTP server.
parameter: str-user - Optional user name for authentication.
parameter: str-pass - Optional password for authentication.

return: On success true, on failure nil.

In case the function fails returning nil, the function SMTP:get-error-text can be used to receive the error text.

(SMTP:send-mail "" "" "Greetings" 
   "How are you today? - john doe -" "" "jdoe" "secret") 
This logs in to the server, tries to authenticate using the username jdoe and password secret (if supplied), and sends an email with the format:
  Subject: Greetings 
  Message: How are you today? - John Doe - 

- ∂ -

generated with newLISP  and newLISPdoc