From: Frank Brehm Date: Fri, 15 Jul 2011 20:48:27 +0000 (+0000) Subject: Versenden mittels SMTP integriert X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=c1b91ac22f936c7865df1ff2ab348b1e83840244;p=my-stuff%2Fpy-logrotate.git Versenden mittels SMTP integriert git-svn-id: http://svn.brehm-online.com/svn/my-stuff/python/PyLogrotate/trunk@299 ec8d2aa5-1599-4edb-8739-2b3a1bc399aa --- diff --git a/LogRotate/Mailer.py b/LogRotate/Mailer.py index 4f1c389..430586e 100755 --- a/LogRotate/Mailer.py +++ b/LogRotate/Mailer.py @@ -38,6 +38,8 @@ from email.mime.multipart import MIMEMultipart from email.mime.nonmultipart import MIMENonMultipart from email.mime.text import MIMEText +import smtplib + from quopri import encodestring as _encodestring # Third party modules @@ -164,6 +166,12 @@ class LogRotateMailer(object): @type: str ''' + self._smtp_timeout = 180 + ''' + @ivar: timeout for communication with the SMTP server + @type: int + ''' + self._smtp_port = 25 ''' @ivar: the port to use for SMTP to the smarthost @@ -358,6 +366,36 @@ class LogRotateMailer(object): "The port to use for sending mails via SMTP" ) + #------------------------------------------------------------ + # Property 'smtp_timeout' + def _get_smtp_timeout(self): + ''' + Getter method for property 'smtp_timeout' + ''' + return self._smtp_timeout + + def _set_smtp_timeout(self, value): + ''' + Setter method for property 'smtp_timeout' + ''' + _ = self.t.lgettext + if value: + timeout = 15 + try: + timeout = int(value) + except ValueError, e: + return + if timeout < 1 or timeout >= 600: + return + self._smtp_timeout = timeout + + smtp_timeout = property( + _get_smtp_timeout, + _set_smtp_timeout, + None, + "The timeout for communication with the SMTP server" + ) + #------------------------------------------------------------ # Property 'smtp_tls' def _get_smtp_tls(self): @@ -445,6 +483,7 @@ class LogRotateMailer(object): res['sendmail'] = self.sendmail res['from'] = self.from_address res['smtp_host'] = self.smtp_host + res['smtp_timeout'] = self.smtp_timeout res['smtp_port'] = self.smtp_port res['smtp_tls'] = self.smtp_tls res['smtp_user'] = self.smtp_user @@ -569,6 +608,10 @@ class LogRotateMailer(object): if not rotate_date: rotate_date = datetime.now() + to_list = [] + for address in addresses: + to_list.append(address[1]) + msg = (_("Sending mail with attached file '%(file)s' to: %(rcpt)s") % {'file': basename, 'rcpt': ', '.join( @@ -582,13 +625,14 @@ class LogRotateMailer(object): self.logger.debug(msg) mail_container = MIMEMultipart() - mail_container['Subject'] = ( "Rotated logfile '%s'" % (filename) ) + mail_container['Date'] = email.utils.formatdate() mail_container['X-Mailer'] = ( "pylogrotate version %s" % (self.mailer_version) ) mail_container['From'] = self.from_address mail_container['To'] = ', '.join( map(lambda x: email.utils.formataddr(x), addresses) ) + mail_container['Subject'] = ( "Rotated logfile '%s'" % (filename) ) mail_container.preamble = ( 'You will not see this in a MIME-aware mail reader.\n' ) @@ -655,12 +699,159 @@ class LogRotateMailer(object): if (not self.use_smtp) and self.sendmail: return self._send_per_sendmail(composed) else: - msg = _("Sending mails via SMTP currently not possible.") - self.logger.info(msg) - return False + return self._send_per_smtp(composed, to_list) return True + #------------------------------------------------------- + def _send_per_smtp(self, mail, to): + ''' + Sending the given mail per SMTP to self.smtp_host + + Raises a LogRotateMailerError on harder errors. + + @param mail: the complete mail (header and body) as a string + @type mail: str + @param to: a list with all addresses of recipients + @type to: list + + @return: success of sending + @rtype: bool + ''' + + _ = self.t.lgettext + + mta = None + + msg = (_("Sending mail via SMTP to server '%s'.") % (self.smtp_host)) + self.logger.debug(msg) + + if self.test_mode: + return True + + # Establishing connection to SMTP server + try: + mta = smtplib.SMTP( + self.smtp_host, + port=self.smtp_port, + timeout=self.smtp_timeout, + ) + except smtplib.SMTPConnectError, e: + msg = (_("Could not connect to server '%(host)s': '%(err)s'.") % + {'host': self.smtp_host, 'err': str(e)}) + self.logger.error(msg) + return False + if self.verbose > 2: + mta.set_debuglevel(1) + + # EHLO/HELO, looking for STARTTLS + has_tls = False + try: + mta.ehlo_or_helo_if_needed() + except smtplib.SMTPHeloError, e: + msg = (_("Error in reply to the EHLO/HELO command from " + + "'%(host)s': '%(err)s'.") % + {'host': self.smtp_host, 'err': str(e)}) + self.logger.error(msg) + return False + except smtplib.SMTPServerDisconnected, e: + msg = (_("Connection to server '%(host)s' unexpected " + + "disconnected: '%(err)s'.") % + {'host': self.smtp_host, 'err': str(e)}) + self.logger.error(msg) + return False + if mta.has_extn('STARTTLS'): + has_tls = True + + # establishing TLS, if possible and necessary + if self.smtp_tls: + if has_tls: + try: + mta.starttls() + except Exception, e: + msg = (_("Error in establishing TLS:") + + str(e)) + self.logger.error(msg) + return False + except smtplib.SMTPServerDisconnected, e: + msg = (_("Connection to server '%(host)s' unexpected " + + "disconnected: '%(err)s'.") % + {'host': self.smtp_host, 'err': str(e)}) + self.logger.error(msg) + return False + else: + msg = (_("SMTP server '%s' doesn't support TLS.") % + (self.smtp_host)) + self.logger.warning(msg) + + # Trying to login, if necessary + if self.smtp_user and self.smtp_passwd: + try: + mta.login(self.smtp_user, self.smtp_passwd) + except smtplib.SMTPAuthenticationError, e: + msg = (_("Login to '%(host)s' as user '%(user)s' was " + + "not successful: '%(err)s'.") % + {'host': self.smtp_host, + 'user': self.smtp_user, + 'err': str(e)}) + self.logger.error(msg) + except smtplib.SMTPException, e: + msg = (_("No suitable authentication method to login " + + "to '%s' found.") % (self.smtp_host)) + self.logger.error(msg) + except smtplib.SMTPServerDisconnected, e: + msg = (_("Connection to server '%(host)s' unexpected " + + "disconnected: '%(err)s'.") % + {'host': self.smtp_host, 'err': str(e)}) + self.logger.error(msg) + return False + + # the underlaying sending of the mail + has_sent = True + rcpt = {} + try: + rcpt = mta.sendmail(self._from_address[1], to, mail) + except smtplib.SMTPSenderRefused, e: + msg = (_("Sender address <%(from)s> not accepted " + + "by host '%(host)s': '%(err)s'.") % + {'host': self.smtp_host, + 'from': self._from_address[1], + 'err': str(e)}) + self.logger.error(msg) + has_sent = False + except smtplib.SMTPRecipientsRefused, e: + msg = ((_("All recipient addresses are rejected " + + "by host '%s':") % (self.smtp_host)) + + repr(e.recipients)) + self.logger.error(msg) + has_sent = False + except smtplib.SMTPDataError, e: + msg = ((_("Mail rejected because of an unexpected error " + + "by host '%s':") % (self.smtp_host)) + + str(e)) + self.logger.error(msg) + has_sent = False + except smtplib.SMTPServerDisconnected, e: + msg = (_("Connection to server '%(host)s' unexpected " + + "disconnected: '%(err)s'.") % + {'host': self.smtp_host, 'err': str(e)}) + self.logger.error(msg) + return False + + if self.verbose > 1: + msg = (_("Mail successful sent to host '%s'.") % (self.smtp_host)) + self.logger.debug(msg) + + if len(rcpt): + msg = ((_("One or more recipient addresses are rejected " + + "by host '%s':") % (self.smtp_host)) + + repr(rcpt)) + self.logger.warning(msg) + + # And bye ... + mta.quit() + return has_sent + #------------------------------------------------------- def _send_per_sendmail(self, mail): ''' diff --git a/po/de/LC_MESSAGES/pylogrotate.po b/po/de/LC_MESSAGES/pylogrotate.po index 577b20c..6d299f3 100644 --- a/po/de/LC_MESSAGES/pylogrotate.po +++ b/po/de/LC_MESSAGES/pylogrotate.po @@ -11,8 +11,8 @@ msgid "" msgstr "" "Project-Id-Version: pylogrotate 0.6.0\n" "Report-Msgid-Bugs-To: frank@brehm-online.com\n" -"POT-Creation-Date: 2011-07-15 17:29+0200\n" -"PO-Revision-Date: 2011-07-15 17:30+0200\n" +"POT-Creation-Date: 2011-07-15 22:00+0200\n" +"PO-Revision-Date: 2011-07-15 22:20+0200\n" "Last-Translator: Frank Brehm \n" "Language-Team: de \n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" @@ -77,6 +77,11 @@ msgstr "Der absolute Pfad der Statusdatei ist jetzt »%s«." msgid "Access to status file '%s' is OK." msgstr "Zugriff auf Statusdatei »%s« ist okay." +#: LogRotate/Mailer.py:823 +#, python-format +msgid "All recipient addresses are rejected by host '%s':" +msgstr "Alle Empfängeradressen wurden von Host »%s« zurückgewiesen:" + #: logrotate.py:83 msgid "Arguments" msgstr "Argumente" @@ -154,7 +159,7 @@ msgstr "" msgid "Child in script '%(name)s' was terminated by signal %(retcode)d." msgstr "Kindprozeß in Skript »%(name)s« wurde durch Signal %(retcode)d beendet." -#: LogRotate/Handler.py:1867 LogRotate/Mailer.py:724 +#: LogRotate/Handler.py:1867 LogRotate/Mailer.py:915 #, python-format msgid "Child was terminated by signal %d." msgstr "Kindprozess wurde durch Signal %d beendet." @@ -222,6 +227,12 @@ msgstr "Nur Überprüfung der Konfiguration." msgid "Configuration reader object structure" msgstr "Objektstruktur des Konfigurtionslesers" +#: LogRotate/Mailer.py:758 LogRotate/Mailer.py:777 LogRotate/Mailer.py:803 +#: LogRotate/Mailer.py:835 +#, python-format +msgid "Connection to server '%(host)s' unexpected disconnected: '%(err)s'." +msgstr "Die Verbindung zum Server »%(host)s« wurde unerwartet beendet: »'%(err)s«." + #: LogRotate/Handler.py:2228 #, python-format msgid "Copying all file metadata to target '%s' ..." @@ -245,6 +256,11 @@ msgstr "" "Kopiere Rechte und Zeitstempel von Quellobjekt »%(src)s« zu Zielojekt " "»%(target)s«." +#: LogRotate/Mailer.py:740 +#, python-format +msgid "Could not connect to server '%(host)s': '%(err)s'." +msgstr "Konnte mich nicht mit Server »%(host)s« verbinden: »%(err)s«." + #: LogRotate/Config.py:1040 #, python-format msgid "Could not detect option in line '%s'." @@ -405,7 +421,18 @@ msgstr "Testmodus, Kommandos werden nur simuliert (beinhaltet -v und -T)" msgid "End of a logfile definition." msgstr "Ende einer Logdateidefinition." -#: LogRotate/Mailer.py:715 +#: LogRotate/Mailer.py:772 +msgid "Error in establishing TLS:" +msgstr "Fehler beim Aufbau einer TLS-Verbindung:" + +#: LogRotate/Mailer.py:752 +#, python-format +msgid "Error in reply to the EHLO/HELO command from '%(host)s': '%(err)s'." +msgstr "" +"Fehler bei Antwort auf das EHLO- bzw. HELO-Kommando von »%(host)s«: " +"»%(err)s«." + +#: LogRotate/Mailer.py:906 #, python-format msgid "Error message of '%s':" msgstr "Fehlermeldung von »%s«:" @@ -484,7 +511,7 @@ msgstr "Fehler beim Löschen der PID-Datei »%(file)s«: %(msg)" msgid "Error removing uncompressed file '%(file)s': %(msg)" msgstr "Fehler beim Löschen der unkomprimierten Datei »%(file)s«: %(msg)" -#: LogRotate/Handler.py:1856 LogRotate/Mailer.py:689 +#: LogRotate/Handler.py:1856 LogRotate/Mailer.py:880 #, python-format msgid "Executing command: '%s'." msgstr "Führe Kommando aus: »%s«." @@ -514,7 +541,7 @@ msgstr "Führe Prerun-Skript »%s« aus ..." msgid "Executing script '%(name)s' with command: '%(cmd)s'" msgstr "Führe Skript »%(name)s« mit dem Kommando »%(cmd)s« aus." -#: LogRotate/Handler.py:1874 LogRotate/Mailer.py:734 +#: LogRotate/Handler.py:1874 LogRotate/Mailer.py:925 #, python-format msgid "Execution failed: %s" msgstr "Ausführung ging schief: %s" @@ -528,7 +555,7 @@ msgstr "Die Ausführung des Skriptes »%(name)s« ging schief: %(error)s" msgid "Failing size definition." msgstr "Fehlende Größenangabe." -#: LogRotate/Config.py:694 LogRotate/Config.py:721 LogRotate/Mailer.py:556 +#: LogRotate/Config.py:694 LogRotate/Config.py:721 LogRotate/Mailer.py:595 #, python-format msgid "File '%s' doesn't exists." msgstr "Die Datei »%s« existiert nicht." @@ -538,7 +565,7 @@ msgstr "Die Datei »%s« existiert nicht." msgid "File '%s' has a size of 0, skip compressing." msgstr "Die Datei »%s« hat die Größe Null, übergehe Komprimierung." -#: LogRotate/Mailer.py:561 +#: LogRotate/Mailer.py:600 #, python-format msgid "File '%s' is not a regular file." msgstr "Die Datei »%s« ist keine reguläre Datei." @@ -677,7 +704,7 @@ msgstr "" "Wert »%(value)s« nach boolscher Option »%(option)s« gefunden, wird " "ignoriert." -#: LogRotate/Mailer.py:652 +#: LogRotate/Mailer.py:696 msgid "Generated E-mail:" msgstr "Generierte E-Mail:" @@ -707,12 +734,12 @@ msgstr "Mailadress-Paar gefunden:" msgid "Got returncode for script '%(name)s': '%(retcode)s'" msgstr "Habe Rückggabewert »%(retcode)s« für Skript »%(name)s« erhalten." -#: LogRotate/Handler.py:1864 LogRotate/Mailer.py:704 +#: LogRotate/Handler.py:1864 LogRotate/Mailer.py:895 #, python-format msgid "Got returncode: '%s'." msgstr "Erhaltener Rückgabewert: »%s«." -#: LogRotate/Mailer.py:615 +#: LogRotate/Mailer.py:659 #, python-format msgid "Guessed content-type: '%(ctype)s' and encoding '%(encoding)s'." msgstr "Erratener Content-Type: »%(ctype)s«, und Encoding: »%(encoding)s«." @@ -753,7 +780,7 @@ msgstr "" msgid "Incompatible version of status file '%(file)s': %(header)s" msgstr "Inkompatible Version der Statusdatei »%(file)s«: %(header)s" -#: LogRotate/Mailer.py:489 +#: LogRotate/Mailer.py:528 msgid "Initial search for the sendmail executable ..." msgstr "Initiale Suche nach dem »sendmail«-Programm ..." @@ -797,7 +824,7 @@ msgstr "Ungültige Gruppe »%(group)s« in »%(what)s«." msgid "Invalid mail address for 'mailfrom' given: '%s'." msgstr "Ungültige Mailadresse »%s« für »mailfrom« angegeben." -#: LogRotate/Mailer.py:229 LogRotate/Mailer.py:233 +#: LogRotate/Mailer.py:237 LogRotate/Mailer.py:241 #, python-format msgid "Invalid mail address given: '%s'." msgstr "Ungültige Mailadresse übergeben: »%s«." @@ -895,6 +922,13 @@ msgstr "" "Die Definition eines Logdateimusters ist innerhalb einer " "Logdateidefinition nicht erlaubt." +#: LogRotate/Mailer.py:792 +#, python-format +msgid "Login to '%(host)s' as user '%(user)s' was not successful: '%(err)s'." +msgstr "" +"Die Anmeldung an »%(host)s« als Nutzer »%(user)s« war nicht erfolgreich: " +"»%(err)s«." + #: LogRotate/Config.py:342 msgid "Logrotate config reader initialised." msgstr "Logrotate-Konfigurationsleser initialisiert." @@ -928,7 +962,19 @@ msgstr "Schaue nach, ob das Postrun-Skript ausgeführt werden soll." msgid "Looking, whether the prerun script should be executed." msgstr "Schaue nach, ob das Prerun-Skript ausgeführt werden soll." -#: LogRotate/Mailer.py:414 +#: LogRotate/Mailer.py:829 +#, python-format +msgid "Mail rejected because of an unexpected error by host '%s':" +msgstr "" +"Die Mail wurd auf Grund eines unerwarteten Fehlers von Host »%s« " +"zurückgewiesen:" + +#: LogRotate/Mailer.py:842 +#, python-format +msgid "Mail successful sent to host '%s'." +msgstr "Die Mail wurde erfolgreich zu Host »%s« gesendet." + +#: LogRotate/Mailer.py:452 msgid "Mailer object will destroyed." msgstr "Das Mailer-Objekt wird zerstört." @@ -1015,7 +1061,7 @@ msgstr "Keine Konfigurationsdatei angegeben." msgid "No dirname directive for olddir given." msgstr "Kein Verzeichnis für olddir-Direktive angegeben." -#: LogRotate/Mailer.py:281 LogRotate/Mailer.py:506 +#: LogRotate/Mailer.py:289 LogRotate/Mailer.py:545 #, python-format msgid "No execute permissions to '%s'." msgstr "Keinw Ausführungsrechte auf »%s«." @@ -1074,7 +1120,7 @@ msgstr "Keine alten Logdateien für Komprimierung gefunden." msgid "No old logfiles to delete found." msgstr "Keine Logdateien zum Löschen gefunden." -#: LogRotate/Mailer.py:711 LogRotate/Mailer.py:720 +#: LogRotate/Mailer.py:902 LogRotate/Mailer.py:911 #, python-format msgid "No output on %s." msgstr "Keine Ausgabe auf %s." @@ -1088,6 +1134,13 @@ msgstr "Kein Recht, ein Signal an Prozeß %d zu senden ..." msgid "No script name given in a script directive." msgstr "Kein Scriptname in Scriptdirektive angegeben." +#: LogRotate/Mailer.py:799 +#, python-format +msgid "No suitable authentication method to login to '%s' found." +msgstr "" +"Keine verwendungsfähige Authentifizierungsmethode zur Anmeldung an »%s« " +"gefunden." + #: LogRotate/Handler.py:598 #, python-format msgid "No useful information found in PID file '%(file)s': '%(line)s'" @@ -1127,7 +1180,12 @@ msgstr "" msgid "Olddir name is now '%s'." msgstr "Der Olddir-Name ist jetzt »%s«." -#: LogRotate/Mailer.py:289 +#: LogRotate/Mailer.py:846 +#, python-format +msgid "One or more recipient addresses are rejected by host '%s':" +msgstr "Eine oder mehrere Empfängeradressen wurden von Host »%s« zurückgewiesen:" + +#: LogRotate/Mailer.py:297 #, python-format msgid "Only absolute path allowed for a sendmail command: '%s'." msgstr "Für das »sendmail«-Kommando sind nur absolute Pfadangaben erlaubt: »%s«." @@ -1219,7 +1277,7 @@ msgstr "Die Option »taboo%s« ist innerhalb einer Logfiledefinition nicht erlau msgid "Options" msgstr "Optionen" -#: LogRotate/Mailer.py:709 +#: LogRotate/Mailer.py:900 #, python-format msgid "Output on STDOUT: '%s'." msgstr "Ausgabe auf STDOUT: »%s«." @@ -1394,6 +1452,11 @@ msgstr "Rotation von »%s« wegen Zwangs-Modus." msgid "Rotating of logfile definition:" msgstr "Rotation der Logdatei-Definition:" +#: LogRotate/Mailer.py:783 +#, python-format +msgid "SMTP server '%s' doesn't support TLS." +msgstr "Der SMTP-Server »%s« unterstützt kein TLS." + #: LogRotate/Config.py:1791 #, python-format msgid "Script name '%s' is allready declared, it will be overwritten." @@ -1409,16 +1472,24 @@ msgstr "Suche nach Muster »%s« ..." msgid "Search path '%s' doesn't exists or is not a directory." msgstr "Der Suchpfad »%s« existiert entweder nicht oder ist kein Verzeichnis." -#: LogRotate/Mailer.py:572 +#: LogRotate/Mailer.py:815 +#, python-format +msgid "Sender address <%(from)s> not accepted by host '%(host)s': '%(err)s'." +msgstr "" +"Die Absenderadresse <%(from)s> wurde von Host »%(host)s« nicht " +"akzeptiert: »%(err)s«." + +#: LogRotate/Mailer.py:726 +#, python-format +msgid "Sending mail via SMTP to server '%s'." +msgstr "Verschicke Mail mittels SMTP an Server »%s«." + +#: LogRotate/Mailer.py:615 #, python-format msgid "Sending mail with attached file '%(file)s' to: %(rcpt)s" msgstr "Verschicke Mail mit angehängter Datei »%(file)s« an: %(rcpt)s" -#: LogRotate/Mailer.py:658 -msgid "Sending mails via SMTP currently not possible." -msgstr "Der Mailversand über SMTP ist gegenwärtig noch nicht verfügbar." - -#: LogRotate/Mailer.py:285 +#: LogRotate/Mailer.py:293 #, python-format msgid "Sendmail command '%s' not found." msgstr "Das »sendmail«-Kommando »%s« wurde nicht gefunden." @@ -1428,7 +1499,7 @@ msgstr "Das »sendmail«-Kommando »%s« wurde nicht gefunden." msgid "Senseless option value '%(value)s' after '%(option)s'." msgstr "Sinnloser Optionswert »%(value)s« nach »%(option)s«." -#: LogRotate/Mailer.py:239 +#: LogRotate/Mailer.py:247 #, python-format msgid "Set sender mail address to: '%s'." msgstr "Setze Absender-Mailadresse auf: »%s«." @@ -1642,7 +1713,7 @@ msgstr "Die Zieldatei der Komprimierung »%s« existiert bereits." msgid "Test mode is ON." msgstr "Testmodus ist AN." -#: LogRotate/Mailer.py:495 +#: LogRotate/Mailer.py:534 #, python-format msgid "Testing for '%s' ..." msgstr "Teste auf »%s« ..." @@ -1657,11 +1728,11 @@ msgstr "Testmodus, übergehe Test der PID-Datei »%s«." msgid "Testmode, skip writing of PID file '%s'." msgstr "Testmodus, übergehe Schreiben der PID-Datei »%s«." -#: LogRotate/Mailer.py:216 +#: LogRotate/Mailer.py:224 msgid "The 'From' address may not set to None." msgstr "Die »From«-Adresse darf nicht auf »None« gesetzt werden." -#: LogRotate/Mailer.py:681 +#: LogRotate/Mailer.py:872 msgid "There is no sendmail executable available." msgstr "Das sendmail-Programm ist nicht verfügbar." @@ -1747,12 +1818,12 @@ msgstr "" "Verwende »%(target)s« als Zieldatei der Rotation von Logdatei " "»%(logfile)s«." -#: LogRotate/Mailer.py:276 LogRotate/Mailer.py:501 +#: LogRotate/Mailer.py:284 LogRotate/Mailer.py:540 #, python-format msgid "Using '%s' as the sendmail command." msgstr "Verwende »%s« als »sendmail«-Kommando." -#: LogRotate/Mailer.py:470 +#: LogRotate/Mailer.py:509 #, python-format msgid "Using <%s> as the sender mail address." msgstr "Verwende <%s> als Absender-Mailadresse." diff --git a/po/pylogrotate.pot b/po/pylogrotate.pot index 3d5594c..727fee4 100644 --- a/po/pylogrotate.pot +++ b/po/pylogrotate.pot @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: pylogrotate 0.6.0\n" "Report-Msgid-Bugs-To: frank@brehm-online.com\n" -"POT-Creation-Date: 2011-07-15 17:29+0200\n" +"POT-Creation-Date: 2011-07-15 22:00+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -74,6 +74,11 @@ msgstr "" msgid "Access to status file '%s' is OK." msgstr "" +#: LogRotate/Mailer.py:823 +#, python-format +msgid "All recipient addresses are rejected by host '%s':" +msgstr "" + #: logrotate.py:83 msgid "Arguments" msgstr "" @@ -149,7 +154,7 @@ msgstr "" msgid "Child in script '%(name)s' was terminated by signal %(retcode)d." msgstr "" -#: LogRotate/Handler.py:1867 LogRotate/Mailer.py:724 +#: LogRotate/Handler.py:1867 LogRotate/Mailer.py:915 #, python-format msgid "Child was terminated by signal %d." msgstr "" @@ -211,6 +216,12 @@ msgstr "" msgid "Configuration reader object structure" msgstr "" +#: LogRotate/Mailer.py:758 LogRotate/Mailer.py:777 LogRotate/Mailer.py:803 +#: LogRotate/Mailer.py:835 +#, python-format +msgid "Connection to server '%(host)s' unexpected disconnected: '%(err)s'." +msgstr "" + #: LogRotate/Handler.py:2228 #, python-format msgid "Copying all file metadata to target '%s' ..." @@ -232,6 +243,11 @@ msgid "" "'%(target)s'." msgstr "" +#: LogRotate/Mailer.py:740 +#, python-format +msgid "Could not connect to server '%(host)s': '%(err)s'." +msgstr "" + #: LogRotate/Config.py:1040 #, python-format msgid "Could not detect option in line '%s'." @@ -388,7 +404,16 @@ msgstr "" msgid "End of a logfile definition." msgstr "" -#: LogRotate/Mailer.py:715 +#: LogRotate/Mailer.py:772 +msgid "Error in establishing TLS:" +msgstr "" + +#: LogRotate/Mailer.py:752 +#, python-format +msgid "Error in reply to the EHLO/HELO command from '%(host)s': '%(err)s'." +msgstr "" + +#: LogRotate/Mailer.py:906 #, python-format msgid "Error message of '%s':" msgstr "" @@ -465,7 +490,7 @@ msgstr "" msgid "Error removing uncompressed file '%(file)s': %(msg)" msgstr "" -#: LogRotate/Handler.py:1856 LogRotate/Mailer.py:689 +#: LogRotate/Handler.py:1856 LogRotate/Mailer.py:880 #, python-format msgid "Executing command: '%s'." msgstr "" @@ -495,7 +520,7 @@ msgstr "" msgid "Executing script '%(name)s' with command: '%(cmd)s'" msgstr "" -#: LogRotate/Handler.py:1874 LogRotate/Mailer.py:734 +#: LogRotate/Handler.py:1874 LogRotate/Mailer.py:925 #, python-format msgid "Execution failed: %s" msgstr "" @@ -509,7 +534,7 @@ msgstr "" msgid "Failing size definition." msgstr "" -#: LogRotate/Config.py:694 LogRotate/Config.py:721 LogRotate/Mailer.py:556 +#: LogRotate/Config.py:694 LogRotate/Config.py:721 LogRotate/Mailer.py:595 #, python-format msgid "File '%s' doesn't exists." msgstr "" @@ -519,7 +544,7 @@ msgstr "" msgid "File '%s' has a size of 0, skip compressing." msgstr "" -#: LogRotate/Mailer.py:561 +#: LogRotate/Mailer.py:600 #, python-format msgid "File '%s' is not a regular file." msgstr "" @@ -652,7 +677,7 @@ msgstr "" msgid "Found value '%(value)s' behind the boolean option '%(option)s', ignoring." msgstr "" -#: LogRotate/Mailer.py:652 +#: LogRotate/Mailer.py:696 msgid "Generated E-mail:" msgstr "" @@ -682,12 +707,12 @@ msgstr "" msgid "Got returncode for script '%(name)s': '%(retcode)s'" msgstr "" -#: LogRotate/Handler.py:1864 LogRotate/Mailer.py:704 +#: LogRotate/Handler.py:1864 LogRotate/Mailer.py:895 #, python-format msgid "Got returncode: '%s'." msgstr "" -#: LogRotate/Mailer.py:615 +#: LogRotate/Mailer.py:659 #, python-format msgid "Guessed content-type: '%(ctype)s' and encoding '%(encoding)s'." msgstr "" @@ -726,7 +751,7 @@ msgstr "" msgid "Incompatible version of status file '%(file)s': %(header)s" msgstr "" -#: LogRotate/Mailer.py:489 +#: LogRotate/Mailer.py:528 msgid "Initial search for the sendmail executable ..." msgstr "" @@ -770,7 +795,7 @@ msgstr "" msgid "Invalid mail address for 'mailfrom' given: '%s'." msgstr "" -#: LogRotate/Mailer.py:229 LogRotate/Mailer.py:233 +#: LogRotate/Mailer.py:237 LogRotate/Mailer.py:241 #, python-format msgid "Invalid mail address given: '%s'." msgstr "" @@ -860,6 +885,11 @@ msgstr "" msgid "Logfile pattern definition not allowed inside a logfile definition." msgstr "" +#: LogRotate/Mailer.py:792 +#, python-format +msgid "Login to '%(host)s' as user '%(user)s' was not successful: '%(err)s'." +msgstr "" + #: LogRotate/Config.py:342 msgid "Logrotate config reader initialised." msgstr "" @@ -893,7 +923,17 @@ msgstr "" msgid "Looking, whether the prerun script should be executed." msgstr "" -#: LogRotate/Mailer.py:414 +#: LogRotate/Mailer.py:829 +#, python-format +msgid "Mail rejected because of an unexpected error by host '%s':" +msgstr "" + +#: LogRotate/Mailer.py:842 +#, python-format +msgid "Mail successful sent to host '%s'." +msgstr "" + +#: LogRotate/Mailer.py:452 msgid "Mailer object will destroyed." msgstr "" @@ -978,7 +1018,7 @@ msgstr "" msgid "No dirname directive for olddir given." msgstr "" -#: LogRotate/Mailer.py:281 LogRotate/Mailer.py:506 +#: LogRotate/Mailer.py:289 LogRotate/Mailer.py:545 #, python-format msgid "No execute permissions to '%s'." msgstr "" @@ -1035,7 +1075,7 @@ msgstr "" msgid "No old logfiles to delete found." msgstr "" -#: LogRotate/Mailer.py:711 LogRotate/Mailer.py:720 +#: LogRotate/Mailer.py:902 LogRotate/Mailer.py:911 #, python-format msgid "No output on %s." msgstr "" @@ -1049,6 +1089,11 @@ msgstr "" msgid "No script name given in a script directive." msgstr "" +#: LogRotate/Mailer.py:799 +#, python-format +msgid "No suitable authentication method to login to '%s' found." +msgstr "" + #: LogRotate/Handler.py:598 #, python-format msgid "No useful information found in PID file '%(file)s': '%(line)s'" @@ -1084,7 +1129,12 @@ msgstr "" msgid "Olddir name is now '%s'." msgstr "" -#: LogRotate/Mailer.py:289 +#: LogRotate/Mailer.py:846 +#, python-format +msgid "One or more recipient addresses are rejected by host '%s':" +msgstr "" + +#: LogRotate/Mailer.py:297 #, python-format msgid "Only absolute path allowed for a sendmail command: '%s'." msgstr "" @@ -1170,7 +1220,7 @@ msgstr "" msgid "Options" msgstr "" -#: LogRotate/Mailer.py:709 +#: LogRotate/Mailer.py:900 #, python-format msgid "Output on STDOUT: '%s'." msgstr "" @@ -1341,6 +1391,11 @@ msgstr "" msgid "Rotating of logfile definition:" msgstr "" +#: LogRotate/Mailer.py:783 +#, python-format +msgid "SMTP server '%s' doesn't support TLS." +msgstr "" + #: LogRotate/Config.py:1791 #, python-format msgid "Script name '%s' is allready declared, it will be overwritten." @@ -1356,16 +1411,22 @@ msgstr "" msgid "Search path '%s' doesn't exists or is not a directory." msgstr "" -#: LogRotate/Mailer.py:572 +#: LogRotate/Mailer.py:815 #, python-format -msgid "Sending mail with attached file '%(file)s' to: %(rcpt)s" +msgid "Sender address <%(from)s> not accepted by host '%(host)s': '%(err)s'." +msgstr "" + +#: LogRotate/Mailer.py:726 +#, python-format +msgid "Sending mail via SMTP to server '%s'." msgstr "" -#: LogRotate/Mailer.py:658 -msgid "Sending mails via SMTP currently not possible." +#: LogRotate/Mailer.py:615 +#, python-format +msgid "Sending mail with attached file '%(file)s' to: %(rcpt)s" msgstr "" -#: LogRotate/Mailer.py:285 +#: LogRotate/Mailer.py:293 #, python-format msgid "Sendmail command '%s' not found." msgstr "" @@ -1375,7 +1436,7 @@ msgstr "" msgid "Senseless option value '%(value)s' after '%(option)s'." msgstr "" -#: LogRotate/Mailer.py:239 +#: LogRotate/Mailer.py:247 #, python-format msgid "Set sender mail address to: '%s'." msgstr "" @@ -1579,7 +1640,7 @@ msgstr "" msgid "Test mode is ON." msgstr "" -#: LogRotate/Mailer.py:495 +#: LogRotate/Mailer.py:534 #, python-format msgid "Testing for '%s' ..." msgstr "" @@ -1594,11 +1655,11 @@ msgstr "" msgid "Testmode, skip writing of PID file '%s'." msgstr "" -#: LogRotate/Mailer.py:216 +#: LogRotate/Mailer.py:224 msgid "The 'From' address may not set to None." msgstr "" -#: LogRotate/Mailer.py:681 +#: LogRotate/Mailer.py:872 msgid "There is no sendmail executable available." msgstr "" @@ -1682,12 +1743,12 @@ msgstr "" msgid "Using '%(target)s' as target for rotation of logfile '%(logfile)s'." msgstr "" -#: LogRotate/Mailer.py:276 LogRotate/Mailer.py:501 +#: LogRotate/Mailer.py:284 LogRotate/Mailer.py:540 #, python-format msgid "Using '%s' as the sendmail command." msgstr "" -#: LogRotate/Mailer.py:470 +#: LogRotate/Mailer.py:509 #, python-format msgid "Using <%s> as the sender mail address." msgstr "" diff --git a/test/apache2 b/test/apache2 index 108ee95..06d0518 100644 --- a/test/apache2 +++ b/test/apache2 @@ -4,12 +4,13 @@ pidfile /home/frank/Development/Python/PyLogrotate/logrotate.pid statusfile /home/frank/Development/Python/PyLogrotate/logrotate.status -mailfrom ich -smtphost mail.brehm-online.com -smtpport 25 -smtpuser vmail -smtppasswd bla -smtptls true + +# mailfrom ich +# smtphost mail.brehm-online.com +# smtpport 25 +# smtpuser vmail +# smtppasswd bla +# smtptls true script apache_restart echo "/etc/init.d/apache2 reload > /dev/null 2>&1 || true"