def sendmail(sender, recipient, subject, body, server='localhost'):
    """Sends an e-mail to the specified recipient."""
body = '<html><head></head><body><pre>%s</pre></body></html>' % body.replace(
    '&', '&').replace('<', '<')
Sending email from gmail using Python