Господа, отправляет ли кто-либо почту из GKE?
def send(body, options):
with open(getenv('SMTP_CREDENTIALS')) as credentials:
auth = json.load(credentials)
# Composing a multipart email:
message = MIMEMultipart('alternative')
message['From'] = '{} <{}>'.format(
options['sender_name'], auth['user'])
message['To'] = COMMASPACE.join(options['recipients'])
message['Subject'] = options['subject']
# Adding the plain text email body:
message.attach(MIMEText(body, 'plain'))
# Connecting to the SMTP server:
with smtplib.SMTP(auth['server'], auth['port']) as smtp:
# Encrypting the connection:
smtp.starttls()
# Logging in and sending the email:
smtp.login(auth['user'], auth['password'])
smtp.send_message(message)