diff --git a/webapp/utils.py b/webapp/utils.py index d79446c..759f8a4 100644 --- a/webapp/utils.py +++ b/webapp/utils.py @@ -157,3 +157,16 @@ def add_to_mailinglist(email: str): ) send_email(to, subject, body) + except ValueError as err: + logging.exception("Formatting of google credentials is incorrect") + + if DEPLOY_ENV == "production": + to = "ilari.ojakorpi@sahkoinsinoorikilta.fi" + subject = "Web error: Failed adding to google groups" + body = "Google credential formatted incorretly\nEmail that was not added: {}\n\nAdd user manually to jäsenet groups.".format( + email + ) + + send_email(to, subject, body) + +