| Allegro CL version 8.0 Moderately revised from 7.0. Significant update since 8.0 release. | |||||||||
Arguments: mail-server from to &rest message
This operator was modified in an update released around February 3, 2006. The change involved the allowable values for message (previously, message could only be a string). See sys:update-allegro for information on updating Allegro CL. A further update allowed specification of a mail server port other than 25 using the mail-server argument, as described below.
This function requests that a SMTP server send a message. The return value of this function is undefined. If this function returns rather than signaling an error, then it has "succeeded", where "success" means the SMTP server claimed that it received the message.
mail-server can be a string naming a machine, or an IP address (in dotted form, as an integer for IPv4 addresses, or an IPv6 address structure). The mail-server is contacted and asked to send a message (a string) from the email address specified by from to the email address or list of addresses specified by to. The email addresses must be of the form "foo" or "foo@bar.com". You can not use addresses like "Joe <foo@bar.com>" or "(Joe) foo@bar.com".
You can also use the mail-server argument to specify in addition the mail server port to be used. See below for details.
If the server specified by mail-server requires authentication, you should use send-smtp-auth, which works just like this function but has additional required arguments login and password.
The message sent is a concatenation of all of the
message arguments (there can be as many as you
like). messages should be strings or streams in
any combination. (message cannot be a mime-part-constructed
object, though see MIME messages below.) When a message is a
stream, note the stream is read until an EOF is reached, but the
stream is not closed nor is the file pointer reset.
A header is not prepended to the message. This means that the application program can build its own header if it wants to include in that header more than send-letter supports (e.g. a Mime encoded attachment). If no header is provided then some mail servers (e.g. sendmail) will notice this fact and will automatically create a header.
The text of the message should be lines separated by #\newline's. The smtp interface will automatically insert the necessary #\returns's when it transmits the message to the mail server.
As said above, message cannot be a mime-part-constructed
object (see MIME support in
imap.htm) but you can do something like this:
(setf p1 (make-mime-part
:text "This is a test message"
:headers '(("From" . "Test User <joe@example.com>")
("To" . "Recipient <jimmy@yahoo.com>")
("Subject" . "This is a test email"))))
(with-mime-part-constructed-stream (s p1)
(send-smtp mail-server "joe@example.com" "jimmy@yahoo.com" s))
By default, this function makes a connection to port 25 on mail-server. If you need to connect to an alternate port, you can specify the mail-server argument in either of the following two ways to specify the alternate port number:
'("smtp.example.com" . 99) and port 99 will
be used.
"smtp.example.com:99". Note that this form is not
suitable if the mail server is specified as an IPv6 dotted address
(because the dotted address uses colons as separators).
See imap.htm for more information.
Copyright (c) 1998-2008, Franz Inc. Oakland, CA., USA. All rights reserved.
This page has had moderate revisions compared to the 7.0 page.
Created 2007.4.30.
| Allegro CL version 8.0 Moderately revised from 7.0. Significant update since 8.0 release. | |||||||||