aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcron/mailpasswds15
1 files changed, 9 insertions, 6 deletions
diff --git a/cron/mailpasswds b/cron/mailpasswds
index 86f49d18..8f1d776d 100755
--- a/cron/mailpasswds
+++ b/cron/mailpasswds
@@ -193,9 +193,6 @@ def main():
poplang = lang
langcnt = cnt
enc = Utils.GetCharSet(poplang)
- # Craft the table header
- header = '%-40s %-10s\n%-40s %-10s' % (
- _('List'), _('Password // URL'), '----', '--------')
# Now we're finally ready to send the email!
siteowner = Utils.get_site_email(host, 'owner')
sitereq = Utils.get_site_email(host, 'request')
@@ -210,16 +207,22 @@ def main():
# Coerce everything to Unicode
text = tounicode(text, enc)
table = [tounicode(_t, enc) for _t in table]
- # Add the table to the end so it doesn't get wrapped/filled
- text += (header + '\n' + NL.join(table))
# Translate the message and headers to user's suggested lang
otrans = i18n.get_translation()
try:
i18n.set_language(poplang)
+ # Craft table header after language was set
+ header = '%-40s %-10s\n%-40s %-10s' % (
+ _('List'), _('Password // URL'), '----', '--------')
+ header = tounicode(header, enc)
+ # Add the table to the end so it doesn't get wrapped/filled
+ text += (header + '\n' + NL.join(table))
msg = Message.UserNotification(
addr, siteowner,
_('%(host)s mailing list memberships reminder'),
- text, poplang)
+ text.encode(enc), poplang)
+ # Note that text must be encoded into 'enc' because unicode
+ # cause error within email module in some language (Japanese).
finally:
i18n.set_translation(otrans)
msg['X-No-Archive'] = 'yes'