"undisclosed-recipients" or not to be
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
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
From: "Peter Bengtsson" <mail@peterbe.com>
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.
"undisclosed-recipients" is sendmails way of telling the receiver that there was no To or Cc tag in the mail header. The reason why you don't have this could be one of several: - Zope versions before 2.4.3 killed the header if you passed subject as parameter. This is not the case with your example here, since there are no headers in the message text. - When you don't specify headers in the mail, MailHost adds them, but unfortunately adds them with the wrong casing, ie "to:" and "from:" instead of "To:" and "From:". It could be that your mail server doesn't understand headers with incorrect casing. These problems are fixed in the MailHostFix I have released. You are welcome to try it and find bugs in it. :-) http://www.zope.org/Members/regebro/mailhostfix It could be a third problem, but then you would have to include the full raw text of the finished received email for me to figure that one out.
participants (3)
-
flynt -
Lennart Regebro -
Peter Bengtsson