- print sys.argv;
- raise UDFormatError, "Incorrect Invokation";
-
- # Send the message through sendmail
- ErrMsg = "A problem occured while trying to send the reply";
- Child = os.popen("/usr/sbin/sendmail -t","w");
-# Child = os.popen("cat","w");
- Child.write(Reply);
- if Child.close() != None:
- raise UDExecuteError, "Sendmail gave a non-zero return code";
-
-except:
- # Error Reply Header
- Date = time.strftime("%a, %d %b %Y %H:%M:%S +0000",time.gmtime(time.time()));
- ErrReplyHead = "To: %s\nReply-To: %s\nDate: %s\n" % (os.environ['SENDER'],ReplyTo,Date);
-
- # Error Body
- Subst = {};
- Subst["__ERROR__"] = ErrMsg;
- Subst["__ADMIN__"] = ReplyTo;
-
- Trace = "==> %s: %s\n" %(sys.exc_type,sys.exc_value);
- List = traceback.extract_tb(sys.exc_traceback);
- if len(List) > 1:
- Trace = Trace + "Python Stack Trace:\n";
- for x in List:
- Trace = Trace + " %s %s:%u: %s\n" %(x[2],x[0],x[1],x[3]);
-
- Subst["__TRACE__"] = Trace;
-
- # Try to send the bounce
- try:
- ErrReply = TemplateSubst(Subst,open(TemplatesDir+"error-reply","r").read());
-
- Child = os.popen("/usr/sbin/sendmail -t -oi -f ''","w");
- Child.write(ErrReplyHead);
- Child.write(ErrReply);
- if Child.close() != None:
- raise UDExecuteError, "Sendmail gave a non-zero return code";
- except:
- sys.exit(EX_TEMPFAIL);
-
- if ErrType != EX_PERMFAIL:
- sys.exit(ErrType);
- sys.exit(0);
+ print sys.argv
+ raise UDFormatError("Incorrect Invokation")
+
+ # Send the message through sendmail
+ ErrMsg = "A problem occured while trying to send the reply"
+ Child = os.popen("/usr/sbin/sendmail -t", "w")
+# Child = os.popen("cat","w")
+ Child.write(Reply)
+ if Child.close() is not None:
+ raise UDExecuteError("Sendmail gave a non-zero return code")
+
+except Exception:
+ # Error Reply Header
+ Date = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime(time.time()))
+ ErrReplyHead = "To: %s\nReply-To: %s\nDate: %s\n" % (os.environ['SENDER'], ReplyTo, Date)
+
+ # Error Body
+ Subst = {}
+ Subst["__ERROR__"] = ErrMsg
+ Subst["__ADMIN__"] = ReplyTo
+
+ Trace = "==> %s: %s\n" % (sys.exc_type, sys.exc_value)
+ List = traceback.extract_tb(sys.exc_traceback)
+ if len(List) > 1:
+ Trace = Trace + "Python Stack Trace:\n"
+ for x in List:
+ Trace = Trace + " %s %s:%u: %s\n" % (x[2], x[0], x[1], x[3])
+
+ Subst["__TRACE__"] = Trace
+
+ # Try to send the bounce
+ try:
+ ErrReply = TemplateSubst(Subst, open(TemplatesDir + "error-reply", "r").read())
+
+ Child = os.popen("/usr/sbin/sendmail -t -oi -f ''", "w")
+ Child.write(ErrReplyHead)
+ Child.write(ErrReply)
+ if Child.close() is not None:
+ raise UDExecuteError("Sendmail gave a non-zero return code")
+ except Exception:
+ sys.exit(EX_TEMPFAIL)
+
+ if ErrType != EX_PERMFAIL:
+ sys.exit(ErrType)
+ sys.exit(0)