Changeset 1353 for pykota

Show
Ignore:
Timestamp:
02/19/04 15:20:21 (21 years ago)
Author:
jalet
Message:

maildomain pykota.conf directive added.
Small improvements on mail headers quality.

Location:
pykota/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/conf/pykota.conf.sample

    r1345 r1353  
    3333 
    3434# Quota Storage Server hostname (and optional port) 
    35 # e.g. db.mydomain.com:5432 
     35# e.g. db.example.com:5432 
    3636storageserver: localhost 
    3737 
     
    136136# If the value is not set then localhost is used. 
    137137smtpserver: localhost 
     138 
     139# Email domain 
     140# If the value is not set, and the mail attribute for the user 
     141# is not set in the PyKota storage, be it LDAP (see usermail directive 
     142# above) or PostgreSQL, then email messages are sent to  
     143# username@smtpserver 
     144# 
     145# If the value is set, then email messages are sent to 
     146# username@maildomain using the SMTP server defined above 
     147# 
     148# Set the appropriate value below, example.com set as per RFC2606. 
     149maildomain: example.com 
    138150 
    139151# Should we force usernames to be all lowercase when printing ? 
     
    304316# In the lines below "%(printer)s" is automatically replaced 
    305317# at run time with your printer's Fully Qualified Domain Name 
    306 # e.g. myprinter.domain.com 
     318# e.g. myprinter.example.com 
    307319# 
    308320# Only snmp(community, oid) and external(command) are supported 
  • pykota/trunk/NEWS

    r1351 r1353  
    2222PyKota NEWS : 
    2323 
     24    - 1.18alpha6 : 
     25         
     26        - New configuration directive added : maildomain 
     27          to specify the domain to send mail to when user  
     28          email address is not set in PyKota database. 
     29           
     30        - More complete email message headers.   
     31           
    2432    - 1.18alpha5 : 
    2533     
  • pykota/trunk/pykota/config.py

    r1257 r1353  
    2222# 
    2323# $Log$ 
     24# Revision 1.43  2004/02/19 14:20:21  jalet 
     25# maildomain pykota.conf directive added. 
     26# Small improvements on mail headers quality. 
     27# 
    2428# Revision 1.42  2004/01/08 14:10:32  jalet 
    2529# Copyright year changed. 
     
    371375            return "localhost" 
    372376         
     377    def getMailDomain(self) :     
     378        """Returns the mail domain to use to send messages to users.""" 
     379        try : 
     380            return self.getGlobalOption("maildomain") 
     381        except PyKotaConfigError :     
     382            return  
     383         
    373384    def getAdminMail(self, printername) :     
    374385        """Returns the Email address of the Print Quota Administrator.""" 
  • pykota/trunk/pykota/tool.py

    r1290 r1353  
    2222# 
    2323# $Log$ 
     24# Revision 1.73  2004/02/19 14:20:21  jalet 
     25# maildomain pykota.conf directive added. 
     26# Small improvements on mail headers quality. 
     27# 
    2428# Revision 1.72  2004/01/14 15:51:19  jalet 
    2529# Docstring added. 
     
    317321        self.storage = storage.openConnection(self) 
    318322        self.smtpserver = self.config.getSMTPServer() 
     323        self.maildomain = self.config.getMailDomain() 
    319324         
    320325    def logdebug(self, message) :     
     
    425430        """Sends an email message containing headers to some user.""" 
    426431        if "@" not in touser : 
    427             touser = "%s@%s" % (touser, self.smtpserver) 
     432            touser = "%s@%s" % (touser, self.maildomain or self.smtpserver) 
    428433        server = smtplib.SMTP(self.smtpserver) 
    429434        try : 
    430             server.sendmail(adminmail, [touser], fullmessage) 
     435            server.sendmail(adminmail, [touser], "From: %s\nTo: %s\n%s" % (adminmail, touser, fullmessage)) 
    431436        except smtplib.SMTPRecipientsRefused, answer :     
    432437            for (k, v) in answer.recipients.items() : 
     
    574579        email = user.Email or user.Name 
    575580        if "@" not in email : 
    576             email = "%s@%s" % (email, self.smtpserver) 
     581            email = "%s@%s" % (email, self.maildomain or self.smtpserver) 
    577582        os.system(cmd % locals()) 
    578583     
  • pykota/trunk/pykota/version.py

    r1351 r1353  
    2222# 
    2323 
    24 __version__ = "1.18alpha5_unofficial" 
     24__version__ = "1.18alpha6_unofficial" 
    2525 
    2626__doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""