[Zope] Sending mail from zope?

Johan Carlsson johanc@torped.se
Sun, 2 Jan 2000 14:38:55 +0100


> 
> Hi all
> 
> I understand that it is possible to have Zope send automatic mail 
> when say a
> resource does not exist. Is it possible to do it when a URL is requested
> that does not exist and can anybody point me to the documentation.
> 
> Thanks
> Steve


I don't know anything about automatic mail functions in Zope
but it can certainly be automated.


First you need to create a SendMail/MailHost method that formats the mail
and defines who and how its sent (e.g. SMTP-host, email-address etc.)
(See the Zope Document Template Markup Language User’s Guide page 53
 for more info about the sendmail-tag)

[your_mail_method]
<dtml-sendmail smtphost="mailhost">
To: email-address@domain.top
From: email-address@domain.top
Reply-to: email-address@domain.top
Subject: Your subject

Your e-mail body.
...
</dtml-sendmail>


Second you need to catch the "NotFound" error in the standard_error_message method.

[standard_error_message]
...
<dtml-if "_.has_key('error_type')">
  <dtml-if "error_type=='NotFound'">
    <dtml-call your_mail_method>
  <dtml-else>
    ...
  </dtml-if>
</dtml-if>
...


Best Regards,
Johan Carlsson