I can confirm that the forum formatter has mangled the first two lines for reasons best known to itself. I’ve managed to now post the lines correctly by adding a space at the start of lines 1 and 2.
First two lines should be (if you copy and paste please delete the space I have had to insert at the beginning of each line)
#!/usr/bin/env python
-- coding: utf-8 --
There should also be a leading # on the line “send email”
I think it should be OK now, but any difficulties have a look at arty2’s post at Sending email with My Cloud