OLD | NEW |
1 import hashlib | 1 import hashlib |
2 import hmac | 2 import hmac |
3 import json | 3 import json |
4 import logging | 4 import logging |
5 import time | 5 import time |
6 | 6 |
7 from google.appengine.api import app_identity | 7 from google.appengine.api import app_identity |
8 from google.appengine.api import mail | 8 from google.appengine.api import mail |
9 from google.appengine.ext import ndb | 9 from google.appengine.ext import ndb |
10 import webapp2 | 10 import webapp2 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 build_data['project_name'], | 176 build_data['project_name'], |
177 from_addr, | 177 from_addr, |
178 subject=subject_template) | 178 subject=subject_template) |
179 | 179 |
180 | 180 |
181 text_content, html_content, subject = template.genMessageContent(build_data) | 181 text_content, html_content, subject = template.genMessageContent(build_data) |
182 | 182 |
183 mail_override = ['stip@chromium.org', | 183 mail_override = ['stip@chromium.org', |
184 'gatekeeper-ng@chromium-gatekeeper-sentry.appspotmail.com'] | 184 'gatekeeper-ng@chromium-gatekeeper-sentry.appspotmail.com'] |
185 | 185 |
| 186 whitelist = ['jschuh'] |
| 187 |
| 188 for alias in whitelist: |
| 189 for domain in ('@chromium.org', '@google.com'): |
| 190 candidate = alias + domain |
| 191 if candidate in recipients: |
| 192 mail_override.append(candidate) |
| 193 |
186 message = mail.EmailMessage(sender=from_addr, | 194 message = mail.EmailMessage(sender=from_addr, |
187 subject=subject, | 195 subject=subject, |
188 #to=recipients, | 196 #to=recipients, |
189 to=mail_override, | 197 to=mail_override, |
190 body=text_content, | 198 body=text_content, |
191 html=html_content) | 199 html=html_content) |
192 logging.info('sending email to %s', recipients) | 200 logging.info('sending email to %s', recipients) |
193 logging.info('sending from %s', from_addr) | 201 logging.info('sending from %s', from_addr) |
194 logging.info('subject is %s', subject) | 202 logging.info('subject is %s', subject) |
195 message.send() | 203 message.send() |
196 self.response.out.write('email sent') | 204 self.response.out.write('email sent') |
197 | 205 |
198 | 206 |
199 app = webapp2.WSGIApplication([('/mailer', MainPage), | 207 app = webapp2.WSGIApplication([('/mailer', MainPage), |
200 ('/mailer/email', Email)], | 208 ('/mailer/email', Email)], |
201 debug=True) | 209 debug=True) |
OLD | NEW |