Index: main/waeup.kofa/trunk/CHANGES.txt
===================================================================
--- main/waeup.kofa/trunk/CHANGES.txt	(revision 11584)
+++ main/waeup.kofa/trunk/CHANGES.txt	(revision 11585)
@@ -4,4 +4,9 @@
 1.2dev (unreleased)
 ===================
+
+* When sending mails, always set from-address to 'no-reply@waeup.org'.
+  Real from-addresses are now set in Cc and Reply-To fields. This is
+  to tackle problems with yahoo (does not allow yahoo.com mails to be
+  sent from non-yahoo servers).
 
 * Multiple payments in special application containers enabled.
Index: main/waeup.kofa/trunk/src/waeup/kofa/smtp.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/smtp.py	(revision 11584)
+++ main/waeup.kofa/trunk/src/waeup/kofa/smtp.py	(revision 11585)
@@ -52,4 +52,8 @@
 from zope.sendmail.interfaces import IMailDelivery
 from waeup.kofa.interfaces import IMailService
+
+
+#: The hardcoded from address. Must not by yahoo.com.
+FROM_ADDRESS = 'no-reply@waeup.org'
 
 
@@ -158,4 +162,18 @@
               subject, body, config=None):
     """Send mail.
+
+    Use `IMailService` to send a mail with the parameters
+    delivered.
+
+    Please note: the `from_addr` given will be used for the reply-to
+    and cc field only. It will _not_ be used for the `from` field, as
+    yahoo does not allow non-yahoo servers to deliver mail with
+    ``@yahoo.com`` in the from-field.
+
+    The from-address set here will be: `FROM_ADDRESS` as set above.
+
+    XXX: The hard-coded from-address should be changable or be
+         determined smarter by looking up a FQDN or similar.
+
     """
     # format message
@@ -165,6 +183,9 @@
         body_to += '%s, ' % encode_address(email, rcpt_name)
     body = encode_body(body)
-    body["From"] = body["Cc"] = encode_address(from_addr, from_name)
+    sender_addr = encode_address(FROM_ADDRESS, from_name)
+    reply_addr = encode_address(from_addr, from_name)
+    body["From"] = sender_addr
     body["To"] = body_to.strip(', ')
+    body["Cc"] = body["Reply-To"] = reply_addr
     body["Subject"] = encode_header_item(subject)
 
Index: main/waeup.kofa/trunk/src/waeup/kofa/tests/test_smtp.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/tests/test_smtp.py	(revision 11584)
+++ main/waeup.kofa/trunk/src/waeup/kofa/tests/test_smtp.py	(revision 11585)
@@ -56,4 +56,5 @@
 #
 
+
 def external_mail_test(func):
     if not EXTERNAL_MAIL_TESTS:
@@ -65,4 +66,5 @@
         return
     return func
+
 
 class HelperTests(unittest.TestCase):
@@ -86,5 +88,5 @@
         # we can correctly encode address parts
         result1 = encode_address('foo@bar.baz')
-        result2 = encode_address(u'foo@bar.baz', 'The Foo' )
+        result2 = encode_address(u'foo@bar.baz', 'The Foo')
         result3 = encode_address('foo@bar.baz', u'The Foo')
         result4 = encode_address('foo@bar.baz', u'With Umläut')
@@ -141,5 +143,5 @@
         # they contain chars unrepresentable in ascii but available in latin1
         text = u"Simple text with ü and capital pi: " + unichr(0x3a0)
-        text = text.encode('utf-8') # turn unicode into byte stream
+        text = text.encode('utf-8')  # turn unicode into byte stream
         result1 = encode_body(text)
         result1 = str(result1).split('\n')[1:]
@@ -173,4 +175,5 @@
             u"Simple text with ü and capital pi: " + unichr(0x3a0))
         return
+
 
 class FunctionalMailerTests(FunctionalTestCase):
@@ -233,12 +236,14 @@
         self.assertEqual(
             self.get_fake_smtp_output().split('\n'),
-            [u'Sending email from sender@example.com to recpt@example.com, sender@example.com:',
+            [u'Sending email from sender@example.com to '
+             u'recpt@example.com, sender@example.com:',
              u'Message:',
              u'msg: MIME-Version: 1.0',
              u'msg: Content-Type: text/plain; charset="us-ascii"',
              u'msg: Content-Transfer-Encoding: 7bit',
-             u'msg: From: A sender <sender@example.com>',
+             u'msg: From: A sender <no-reply@waeup.org>',
+             u'msg: To: A recipient <recpt@example.com>',
              u'msg: Cc: A sender <sender@example.com>',
-             u'msg: To: A recipient <recpt@example.com>',
+             u'msg: Reply-To: A sender <sender@example.com>',
              u'msg: Subject: A subject',
              u'msg: ',
@@ -258,11 +263,13 @@
         self.assertEqual(
             self.get_fake_smtp_output().split('\n'),
-            [u'Sending email from sender@example.com to recpt@example.com, sender@example.com:',
+            [u'Sending email from sender@example.com '
+             u'to recpt@example.com, sender@example.com:',
              u'Message:', u'msg: MIME-Version: 1.0',
              u'msg: Content-Type: text/plain; charset="iso-8859-1"',
              u'msg: Content-Transfer-Encoding: quoted-printable',
-             u'msg: From: A sender <sender@example.com>',
+             u'msg: From: A sender <no-reply@waeup.org>',
+             u'msg: To: A recipient <recpt@example.com>',
              u'msg: Cc: A sender <sender@example.com>',
-             u'msg: To: A recipient <recpt@example.com>',
+             u'msg: Reply-To: A sender <sender@example.com>',
              u'msg: Subject: A subject',
              u'msg: ',
@@ -282,11 +289,13 @@
         self.assertEqual(
             self.get_fake_smtp_output().split('\n'),
-            [u'Sending email from sender@example.com to recpt@example.com, sender@example.com:',
+            [u'Sending email from sender@example.com '
+             u'to recpt@example.com, sender@example.com:',
              u'Message:', u'msg: MIME-Version: 1.0',
              u'msg: Content-Type: text/plain; charset="iso-8859-1"',
              u'msg: Content-Transfer-Encoding: quoted-printable',
-             u'msg: From: A sender <sender@example.com>',
+             u'msg: From: A sender <no-reply@waeup.org>',
+             u'msg: To: A recipient <recpt@example.com>',
              u'msg: Cc: A sender <sender@example.com>',
-             u'msg: To: A recipient <recpt@example.com>',
+             u'msg: Reply-To: A sender <sender@example.com>',
              u'msg: Subject: A subject',
              u'msg: ',
@@ -337,6 +346,6 @@
             )
         import transaction
-        transaction.commit() # The mail is really sent when transactions is
-                             # committed
+        transaction.commit()  # The mail is really sent when transactions is
+                              # committed
         self.assertTrue('@' in result)
         return
@@ -355,6 +364,6 @@
             )
         import transaction
-        transaction.commit() # The mail is really sent when transactions is
-                             # committed
+        transaction.commit()  # The mail is really sent when transactions is
+                              # committed
         self.assertTrue('@' in result)
         return
@@ -372,6 +381,6 @@
             )
         import transaction
-        transaction.commit() # The mail is really sent when transactions is
-                             # committed
+        transaction.commit()  # The mail is really sent when transactions is
+                              # committed
         self.assertTrue('@' in result)
         return
