don't work! WHY?
import sendgrid from sendgrid.helpers.mail import Email, Mail, Content API_KEY = 'my.key' SUBJECT = 'Welcome' BODY = 'Hi {}' def send_email(email, name): global API_KEY global SUBJECT global BODY BODY = BODY.format(name) message = Mail( from_email = 'steve@example.com', to_emails = email, subject = SUBJECT, html_content = BODY ) message.content = Content('text/plain', BODY) sg = sendgrid.SendGridAPIClient(API_KEY) response = sg.send(message) if __name__ == '__main__': #These "asserts" using only for self-checking and not necessary for auto-testing send_email('somebody@gmail.com', 'Some Body') print('Done')