[3356] | 1 | ############################################################################## |
---|
| 2 | # |
---|
| 3 | # Copyright (c) 2002 Zope Foundation and Contributors. |
---|
| 4 | # |
---|
| 5 | # This software is subject to the provisions of the Zope Public License, |
---|
| 6 | # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. |
---|
| 7 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
---|
| 8 | # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
---|
| 9 | # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
---|
| 10 | # FOR A PARTICULAR PURPOSE |
---|
| 11 | # |
---|
| 12 | ############################################################################## |
---|
| 13 | |
---|
| 14 | def manage_addMailHost(id, title='', smtp_host=None, |
---|
| 15 | localhost='localhost', smtp_port=25, |
---|
| 16 | timeout=1.0): |
---|
| 17 | """ |
---|
| 18 | |
---|
| 19 | Add a mailhost object to an ObjectManager. |
---|
| 20 | |
---|
| 21 | """ |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | class MailHost: |
---|
| 25 | """ |
---|
| 26 | MailHost objects work as adapters to Simple Mail Transfer Protocol |
---|
| 27 | (SMTP) servers. MailHosts are used by DTML 'sendmail' tags |
---|
| 28 | to find the proper host to deliver mail to. |
---|
| 29 | """ |
---|
| 30 | |
---|
| 31 | def send(messageText, mto=None, mfrom=None, subject=None, |
---|
| 32 | encode=None): |
---|
| 33 | """ |
---|
| 34 | Sends an email message where the messageText is an rfc822 formatted |
---|
| 35 | message. This allows you complete control over the message headers, |
---|
| 36 | including setting any extra headers such as Cc: and Reply-To:. |
---|
| 37 | The arguments are: |
---|
| 38 | |
---|
| 39 | messageText -- The mail message. It can either be a rfc822 |
---|
| 40 | formed text with header fields, or just a body without any |
---|
| 41 | header fields. The other arguments given will override the |
---|
| 42 | header fields in the message, if they exist. |
---|
| 43 | |
---|
| 44 | mto -- A commaseparated string or list of recipient(s) of the message. |
---|
| 45 | |
---|
| 46 | mfrom -- The address of the message sender. |
---|
| 47 | |
---|
| 48 | subject -- The subject of the message. |
---|
| 49 | |
---|
| 50 | encode -- The rfc822 defined encoding of the message. The |
---|
| 51 | default of 'None' means no encoding is done. Valid values |
---|
| 52 | are 'base64', 'quoted-printable' and 'uuencode'. |
---|
| 53 | |
---|
| 54 | """ |
---|
| 55 | |
---|
| 56 | def simple_send(self, mto, mfrom, subject, body): |
---|
| 57 | """ |
---|
| 58 | Sends a message. Only To:, From: and Subject: headers can be set. |
---|
| 59 | Note that simple_send does not process or validate its arguments |
---|
| 60 | in any way. |
---|
| 61 | The arguments are: |
---|
| 62 | |
---|
| 63 | mto -- A commaseparated string of recipient(s) of the message. |
---|
| 64 | |
---|
| 65 | mfrom -- The address of the message sender. |
---|
| 66 | |
---|
| 67 | subject -- The subject of the message. |
---|
| 68 | |
---|
| 69 | body -- The body of the message. |
---|
| 70 | """ |
---|