comparison sat/plugins/plugin_misc_account.py @ 3055:82eee2c383d9

plugin account: fixed email sending
author Goffi <goffi@goffi.org>
date Fri, 11 Oct 2019 16:15:34 +0200
parents ab2696e34d29
children 0c29155ac68b
comparison
equal deleted inserted replaced
3054:92f8baec5e4f 3055:82eee2c383d9
311 body = """New account created: {profile} [{email}]""".format( 311 body = """New account created: {profile} [{email}]""".format(
312 profile=profile, 312 profile=profile,
313 # there is no email when an existing XMPP account is used 313 # there is no email when an existing XMPP account is used
314 email=email or "<no email>", 314 email=email or "<no email>",
315 ) 315 )
316 d_admin = sat_email.sendEmail(self.host, admins_emails, subject, body) 316 d_admin = sat_email.sendEmail(
317 self.host.memory.config, admins_emails, subject, body)
317 318
318 admins_emails_txt = ", ".join(["<" + addr + ">" for addr in admins_emails]) 319 admins_emails_txt = ", ".join(["<" + addr + ">" for addr in admins_emails])
319 d_admin.addCallbacks( 320 d_admin.addCallbacks(
320 lambda __: log.debug( 321 lambda __: log.debug(
321 "Account creation notification sent to admin(s) {}".format( 322 "Account creation notification sent to admin(s) {}".format(
339 body = _(WELCOME_MSG).format(profile=profile, jid=jid_s, domain=domain) 340 body = _(WELCOME_MSG).format(profile=profile, jid=jid_s, domain=domain)
340 341
341 # XXX: this will not fail when the email address doesn't exist 342 # XXX: this will not fail when the email address doesn't exist
342 # FIXME: check email reception to validate email given by the user 343 # FIXME: check email reception to validate email given by the user
343 # FIXME: delete the profile if the email could not been sent? 344 # FIXME: delete the profile if the email could not been sent?
344 d_user = sat_email.sendEmail(self.host, [email], subject, body) 345 d_user = sat_email.sendEmail(self.host.memory.config, [email], subject, body)
345 d_user.addCallbacks( 346 d_user.addCallbacks(
346 lambda __: log.debug( 347 lambda __: log.debug(
347 "Account creation confirmation sent to <{}>".format(email) 348 "Account creation confirmation sent to <{}>".format(email)
348 ), 349 ),
349 self._sendEmailEb, 350 self._sendEmailEb,