def send_update_mail(self, bad_posts, gplus_id):
        """Send out a mail with a link to the post for update."""

        # if we run this from the staging environment do not send emails
        app = app_identity.get_default_version_hostname()
        if app == "elite-firefly-737.appspot.com":
            logging.info('running from %s, not sending bad post email', app)
            return

        logging.info('sending a bad_post mail')

        # get the user
        accounts = Account.query(Account.gplus_id == gplus_id)

        for account in accounts:
            email = account.email

        body_s = "The Expert Tracking team thanks you for using the tool. \n\n"
        body_s += "The following post(s) is(are) missing Activity Type and/or Product Group hashtags. "
        body_s += "Because of this, it(they) does not reflect in your Expert stats. \n\n"

        for bad_post in bad_posts:
            body_s += "%s \n" % bad_post

        body_s += "\nKindly update your post(s) with #hashtags. A reminder of the valid "
        body_s += "hashtags can be found in the 'How Its Used?' section of http://gdetracking.gweb.io/. \n\n"
        body_s += "Expert Tracking Team"

        try:
            mail.send_mail(sender="Expert Tracking App Support <no-reply@omega-keep-406.appspotmail.com>",
                           to=email,
                           subject="Expert Activity Tracker : Missing hashtags on ActivityPost for %s " % datetime.now(
                           ).strftime("%Y-%m-%d"),
                           body="""%s""" % body_s)
        except:
            logging.warning(
                "error sending email check user account %s", str(account.display_name))
dataset/ETHPy150Open GoogleDeveloperExperts/experts-app-backend/services/update_gplus.py/TaskUpdateGplus.send_update_mail/original