Index: pykota/trunk/conf/pykota.conf.sample
===================================================================
--- pykota/trunk/conf/pykota.conf.sample (revision 1345)
+++ pykota/trunk/conf/pykota.conf.sample (revision 1353)
@@ -33,5 +33,5 @@
 
 # Quota Storage Server hostname (and optional port)
-# e.g. db.mydomain.com:5432
+# e.g. db.example.com:5432
 storageserver: localhost
 
@@ -136,4 +136,16 @@
 # If the value is not set then localhost is used.
 smtpserver: localhost
+
+# Email domain
+# If the value is not set, and the mail attribute for the user
+# is not set in the PyKota storage, be it LDAP (see usermail directive
+# above) or PostgreSQL, then email messages are sent to 
+# username@smtpserver
+#
+# If the value is set, then email messages are sent to
+# username@maildomain using the SMTP server defined above
+#
+# Set the appropriate value below, example.com set as per RFC2606.
+maildomain: example.com
 
 # Should we force usernames to be all lowercase when printing ?
@@ -304,5 +316,5 @@
 # In the lines below "%(printer)s" is automatically replaced
 # at run time with your printer's Fully Qualified Domain Name
-# e.g. myprinter.domain.com
+# e.g. myprinter.example.com
 #
 # Only snmp(community, oid) and external(command) are supported
Index: pykota/trunk/pykota/tool.py
===================================================================
--- pykota/trunk/pykota/tool.py (revision 1290)
+++ pykota/trunk/pykota/tool.py (revision 1353)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.73  2004/02/19 14:20:21  jalet
+# maildomain pykota.conf directive added.
+# Small improvements on mail headers quality.
+#
 # Revision 1.72  2004/01/14 15:51:19  jalet
 # Docstring added.
@@ -317,4 +321,5 @@
         self.storage = storage.openConnection(self)
         self.smtpserver = self.config.getSMTPServer()
+        self.maildomain = self.config.getMailDomain()
         
     def logdebug(self, message) :    
@@ -425,8 +430,8 @@
         """Sends an email message containing headers to some user."""
         if "@" not in touser :
-            touser = "%s@%s" % (touser, self.smtpserver)
+            touser = "%s@%s" % (touser, self.maildomain or self.smtpserver)
         server = smtplib.SMTP(self.smtpserver)
         try :
-            server.sendmail(adminmail, [touser], fullmessage)
+            server.sendmail(adminmail, [touser], "From: %s\nTo: %s\n%s" % (adminmail, touser, fullmessage))
         except smtplib.SMTPRecipientsRefused, answer :    
             for (k, v) in answer.recipients.items() :
@@ -574,5 +579,5 @@
         email = user.Email or user.Name
         if "@" not in email :
-            email = "%s@%s" % (email, self.smtpserver)
+            email = "%s@%s" % (email, self.maildomain or self.smtpserver)
         os.system(cmd % locals())
     
Index: pykota/trunk/pykota/config.py
===================================================================
--- pykota/trunk/pykota/config.py (revision 1257)
+++ pykota/trunk/pykota/config.py (revision 1353)
@@ -22,4 +22,8 @@
 #
 # $Log$
+# Revision 1.43  2004/02/19 14:20:21  jalet
+# maildomain pykota.conf directive added.
+# Small improvements on mail headers quality.
+#
 # Revision 1.42  2004/01/08 14:10:32  jalet
 # Copyright year changed.
@@ -371,4 +375,11 @@
             return "localhost"
         
+    def getMailDomain(self) :    
+        """Returns the mail domain to use to send messages to users."""
+        try :
+            return self.getGlobalOption("maildomain")
+        except PyKotaConfigError :    
+            return 
+        
     def getAdminMail(self, printername) :    
         """Returns the Email address of the Print Quota Administrator."""
Index: pykota/trunk/pykota/version.py
===================================================================
--- pykota/trunk/pykota/version.py (revision 1351)
+++ pykota/trunk/pykota/version.py (revision 1353)
@@ -22,5 +22,5 @@
 #
 
-__version__ = "1.18alpha5_unofficial"
+__version__ = "1.18alpha6_unofficial"
 
 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""
Index: pykota/trunk/NEWS
===================================================================
--- pykota/trunk/NEWS (revision 1351)
+++ pykota/trunk/NEWS (revision 1353)
@@ -22,4 +22,12 @@
 PyKota NEWS :
 
+    - 1.18alpha6 :
+        
+        - New configuration directive added : maildomain
+          to specify the domain to send mail to when user 
+          email address is not set in PyKota database.
+          
+        - More complete email message headers.  
+          
     - 1.18alpha5 :
     
