# $Id: mod_mail.py 3484 2006-06-10 22:38:44Z genone $
import portage_mail, socket, os, time
+from portage_exception import PortageException
+from portage_util import writemsg
from email.MIMEText import MIMEText as TextMessage
_items = {}
mymessage = portage_mail.create_message(myfrom, myrecipient, mysubject,
mybody, attachments=items.values())
- portage_mail.send_mail(mysettings, mymessage)
+ try:
+ portage_mail.send_mail(mysettings, mymessage)
+ except PortageException, e:
+ writemsg("%s\n" % str(e), noiselevel=-1)
return
try:
if int(mymailport) > 100000:
myconn = smtplib.SMTP(mymailhost, int(mymailport) - 100000)
+ myconn.ehlo()
+ if not myconn.has_extn("STARTTLS"):
+ raise portage_exception.PortageException("!!! TLS support requested for logmail but not suported by server")
myconn.starttls()
+ myconn.ehlo()
else:
myconn = smtplib.SMTP(mymailhost, mymailport)
if mymailuser != "" and mymailpasswd != "":