Ignore:
Timestamp:
10 Apr 2014, 12:57:45 (10 years ago)
Author:
uli
Message:

When sending mail, use waeup.org address for from-field.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/smtp.py

    r11584 r11585  
    5252from zope.sendmail.interfaces import IMailDelivery
    5353from waeup.kofa.interfaces import IMailService
     54
     55
     56#: The hardcoded from address. Must not by yahoo.com.
     57FROM_ADDRESS = 'no-reply@waeup.org'
    5458
    5559
     
    158162              subject, body, config=None):
    159163    """Send mail.
     164
     165    Use `IMailService` to send a mail with the parameters
     166    delivered.
     167
     168    Please note: the `from_addr` given will be used for the reply-to
     169    and cc field only. It will _not_ be used for the `from` field, as
     170    yahoo does not allow non-yahoo servers to deliver mail with
     171    ``@yahoo.com`` in the from-field.
     172
     173    The from-address set here will be: `FROM_ADDRESS` as set above.
     174
     175    XXX: The hard-coded from-address should be changable or be
     176         determined smarter by looking up a FQDN or similar.
     177
    160178    """
    161179    # format message
     
    165183        body_to += '%s, ' % encode_address(email, rcpt_name)
    166184    body = encode_body(body)
    167     body["From"] = body["Cc"] = encode_address(from_addr, from_name)
     185    sender_addr = encode_address(FROM_ADDRESS, from_name)
     186    reply_addr = encode_address(from_addr, from_name)
     187    body["From"] = sender_addr
    168188    body["To"] = body_to.strip(', ')
     189    body["Cc"] = body["Reply-To"] = reply_addr
    169190    body["Subject"] = encode_header_item(subject)
    170191
Note: See TracChangeset for help on using the changeset viewer.