| 1 | = Email Channel = |
| 2 | |
| 3 | The Web2Py framework has a Mail class (defined in {{{gluon/tools.py}}}) which we make use of within Eden. |
| 4 | |
| 5 | We configure this through settings in our [DeveloperGuidelines/Templates Templates]. |
| 6 | |
| 7 | These settings are then read in {{models/00_settings.py}}: |
| 8 | {{{ |
| 9 | sender = settings.get_mail_sender() |
| 10 | if sender: |
| 11 | mail.settings.sender = sender |
| 12 | mail.settings.server = settings.get_mail_server() |
| 13 | mail.settings.tls = settings.get_mail_server_tls() |
| 14 | mail_server_login = settings.get_mail_server_login() |
| 15 | if mail_server_login: |
| 16 | mail.settings.login = mail_server_login |
| 17 | # Email settings for registration verification and approval |
| 18 | _settings.mailer = mail |
| 19 | }}} |
| 20 | |
| 21 | We wrap this within our Messaging module (modules/s3/s3msg.py) & so send mails using: |
| 22 | msg.send_email(to, |
| 23 | subject, |
| 24 | message, |
| 25 | attachments=None, |
| 26 | cc=None, |
| 27 | bcc=None, |
| 28 | reply_to=None, |
| 29 | sender="%(sender)s", |
| 30 | encoding="utf-8") |
| 31 | |
| 32 | == Notes == |
| 33 | Can send emails with dynamic data inserted into templates (like HTML pages): |
| 34 | * http://groups.google.com/group/web2py/browse_thread/thread/f6c903f9c67cfe2e |