[Zope] "undisclosed-recipients" or not to be
flynt
flynt@gmx.ch
Tue, 18 Dec 2001 19:25:30 +0100
Peter Bengtsson wrote:
>
> Using the sendmail tag like this...:
>
> <dtml-sendmail mailhost="MailHost">
> To: peter@grenna.net
> From: server@peterbe.com
> Subject: DTML peter@grenna.net to server@peterbe.com
>
> Text text
>
> </dtml-sendmail>
>
> Sends a healthy email from 'server@peterbe.com' to 'peter@grenna.net'.
> But doing this...:
>
> context.MailHost.send('TEST
> MESSAGE','peter@grenna.net','server@peterbe.com','Subject server@peterbe.com
> to peter@grenna.net')
>
> Sends the message but the To line in the message says
> "undisclosed-recipients:;" instead of "peter@grenna.net" like it did with the
> sendmail tag.
>
> Why?
>
> Peter
>
Hi Peter
There was a similar case, just with an external method, some time ago:
http://lists.zope.org/pipermail/zope/2001-November/104654.html
Should be funny that with python scripts the *undisclosed recipients*
just switches the *to* and the *from* field (compared with external
methods).
But the solution is the same (based on the Lundh's *Python Standard
Library* receipt):
import string
message = "This is a test"
mto = "peter@grenna.net"
mfrom = "server@peterbe.com"
subject = "Test Email"
encode = None
body = string.join((
"From: %s" % mfrom,
"To: %s" % mto,
"Subject: %s" % subject,
"",
message), "\r\n")
context.MailHost.send(body, mto, mfrom, subject, encode)
Regards
--- Flynt