@@ -0,0 +1,1976 @@
+# Copyright 2020 Google LLC%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A#      http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS,%0A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A# See the License for the specific language governing permissions and%0A# limitations under the License.%0A%22%22%22%0AClass for sending email notifications about import progress.%0A%22%22%22%0A%0Aimport smtplib%0Afrom typing import List%0A%0Afrom app import utils%0A%0A%0Aclass EmailNotifier:%0A    %22%22%22Class for sending email notifications about import progress.%0A%0A    Attributes:%0A        account: Sender email account as a string.%0A        password: The corresponding password, app password, or access token%0A            as a string.%0A    %22%22%22%0A%0A    def __init__(self, account: str, password: str):%0A        self.account = account%0A        self.password = password%0A%0A    def send(self, subject: str, body: str,%0A             receiver_addresses: List%5Bstr%5D) -%3E None:%0A        %22%22%22Sends an email.%0A%0A        Args:%0A            subject: Email subject as a string.%0A            body: Email body as a string.%0A            receiver_addresses: List of receiver email addresses%0A                each as a string.%0A%0A        Raises:%0A            Same exceptions as smtplib.SMTP_SSL.__init__,%0A            smtplib.SMTP_SSL.login, smtplib.SMTP_SSL.sendmail.%0A        %22%22%22%0A        with smtplib.SMTP_SSL('smtp.gmail.com') as server:%0A            server.login(self.account, self.password)%0A            email = (f'From: %7Bself.account%7D%5Cn'%0A                     f'To: %7Butils.list_to_str(receiver_addresses)%7D%5Cn'%0A                     f'Subject: %7Bsubject%7D%5Cn'%0A                     '%5Cn'%0A                     f'%7Bbody%7D%5Cn')%0A            server.sendmail(self.account, receiver_addresses, email)%0A

add file (#216)