Hello, I just used mailhost=getattr(context, context.superValues('Mail Host')[0].id) mailhost.send('Hello', 'you@something.org', 'me@anything.org', 'Test') to send mails under Zope 2.5.x. Once I updated to Zope 2.6.1 Mails via this method are quite strange. They have no subject in the Mail header but the body part contains: Subject: Test To: you@something.org From: me@anything.org Date: Mon, 31 Mar 2003 10:24:00 +0200 Hello This is really strange and so I searched the web and found http://aspn.activestate.com/ASPN/Mail/Message/zope-List/1412602 Unfortunately that is not the solution but a hint to search the list archive for the problem. I have to admit that I failed to find the solution the sender was refering to. Any hints? Kind regards Andreas. -- Mankind must put an end to war before war puts an end to mankind. John F. Kennedy
Andreas Tille wrote:
Hello,
I just used
mailhost=getattr(context, context.superValues('Mail Host')[0].id) mailhost.send('Hello', 'you@something.org', 'me@anything.org', 'Test')
to send mails under Zope 2.5.x. Once I updated to Zope 2.6.1 Mails via this method are quite strange. They have no subject in the Mail header but the body part contains:
Subject: Test To: you@something.org From: me@anything.org Date: Mon, 31 Mar 2003 10:24:00 +0200
Hello
I'm not able to reproduce this problem. What is the actual body text you are trying to use?
On Mon, 31 Mar 2003, Lennart Regebro wrote:
mailhost=getattr(context, context.superValues('Mail Host')[0].id) mailhost.send('Hello', 'you@something.org', 'me@anything.org', 'Test')
to send mails under Zope 2.5.x. Once I updated to Zope 2.6.1 Mails via this method are quite strange. They have no subject in the Mail header but the body part contains:
Subject: Test To: you@something.org From: me@anything.org Date: Mon, 31 Mar 2003 10:24:00 +0200
Hello
I'm not able to reproduce this problem.
What is the actual body text you are trying to use? Regarding to Zope-Book, Appendix B:
send(messageText, mto=None, mfrom=None, subject=None, encode=None) The body which should be sended is just 'Hello'. BTW, it's not really clear why the mto parameter is optional ... Kind regards Andreas. -- Mankind must put an end to war before war puts an end to mankind. John F. Kennedy
Andreas Tille wrote:
Regarding to Zope-Book, Appendix B:
send(messageText, mto=None, mfrom=None, subject=None, encode=None)
The body which should be sended is just 'Hello'.
Well, it works for me...
BTW, it's not really clear why the mto parameter is optional ...
Well, because you can put it into the message instead. The send() method will complain if you don't have an mto, cc or bcc header either in the message or the parameters. The parameters will by the way always override anything set in the message.
I had a problem exactly like this under pretty much the same config. However my problem was that I had a ':' character after the first word in my body. Unfortunately I have not been able to reproduce your error. Did you try specifying the parameter names. E.g. send(messageText='', mto=''.... HTH AM Andreas Tille wrote:
Hello,
I just used
mailhost=getattr(context, context.superValues('Mail Host')[0].id) mailhost.send('Hello', 'you@something.org', 'me@anything.org', 'Test')
to send mails under Zope 2.5.x. Once I updated to Zope 2.6.1 Mails via this method are quite strange. They have no subject in the Mail header but the body part contains:
Subject: Test To: you@something.org From: me@anything.org Date: Mon, 31 Mar 2003 10:24:00 +0200
Hello
This is really strange and so I searched the web and found
http://aspn.activestate.com/ASPN/Mail/Message/zope-List/1412602
Unfortunately that is not the solution but a hint to search the list archive for the problem. I have to admit that I failed to find the solution the sender was refering to.
Any hints?
Kind regards
Andreas.
-- Mankind must put an end to war before war puts an end to mankind. John F. Kennedy
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
On Mon, 31 Mar 2003, AM wrote:
I had a problem exactly like this under pretty much the same config. However my problem was that I had a ':' character after the first word in my body. Hmm, actually I have a ':' inside the message which is kind of logfile type [date]: event Reading your mail and the hint from Lennart Regebro that it might be possible to specify all mail tags in the message this might be the reason.
Is this documented anywhere? Seems kind of a bug if I can not use certain characters in a mail body without influencing mail header data. :-(
Unfortunately I have not been able to reproduce your error. Did you try specifying the parameter names. E.g. send(messageText='', mto=''.... Yes - I tried both.
Perhaps somebody could try this with a message of the form: something: else At least if I leave out the ':' all works like expected. Kind regards Andreas. -- Mankind must put an end to war before war puts an end to mankind. John F. Kennedy
Andreas Tille wrote:
Hmm, actually I have a ':' inside the message which is kind of logfile type [date]: event Reading your mail and the hint from Lennart Regebro that it might be possible to specify all mail tags in the message this might be the reason.
Is this documented anywhere?
Yes, in the sendmail tag help (not an obvious place) and in the documentation for MailHost.send() in the MailHost/help/MailHost.py file. It's not in the Zope book, though, and it should be. I'll make a comment in the 2.6 version if I can (haven't done that before, so I wouldn't know).
Seems kind of a bug if I can not use certain characters in a mail body without influencing mail header data. :-(
You can use any characters. However, if you start the mail body with a RFC822 header, it will be treated as an RFC822 header. :) Headers look like this: The-Header-Name:<space>The Header Data The headers end with an empty row. Your solution is to make sure the first line of your message does not look like a header, by for example putting the subject there again, or some other text. (Empty blank lines will be stripped, so that doesn't work).
Andreas Tille wrote:
On Mon, 31 Mar 2003, AM wrote:
I had a problem exactly like this under pretty much the same config. However my problem was that I had a ':' character after the first word in my body.
Hmm, actually I have a ':' inside the message which is kind of logfile type [date]: event Reading your mail and the hint from Lennart Regebro that it might be possible to specify all mail tags in the message this might be the reason.
Is this documented anywhere?
Seems kind of a bug if I can not use certain characters in a mail body without influencing mail header data. :-(
Maybe it's only some kind of misunderstanding... Please have a look at Zope/lib/python/Products/MailHost/MailHost.py If you want to send only a message-Body (only the content of a mail), you should use: simple_send(self, mto, mfrom, subject, body): If you want to send a complete messageText (headers + content), you should use: def send(self, messageText, mto=None, mfrom=None, subject=None, encode=None): If you want to use send(...) to send only content, you should format your messageText as messageText="\n"+messageBody. Cheers, Maik
participants (4)
-
AM -
Andreas Tille -
Lennart Regebro -
Maik Jablonski