Как из скрипта на Питоне послать письмо с вложением?
Отправить письмо с  файлом `file_path`  на адрес `receiver_email` с smtp-сервера `smtp_server` с логином `sender_email` и паролем `password`

basename = os.path.basename(file_path)\n

# Compose attachment\n
part = MIMEBase('application', "octet-stream")\n
part.set_payload(open(file_path ,"rb").read() )\n
encoders.encode_base64(part)\n
part.add_header('Content-Disposition', 'attachment; filename="%s"' % basename)\n

# Compose message\n
msg = MIMEMultipart()\n
msg['From'] = sender_email\n
msg['To'] = receiver_email\n
msg.attach(part)\n

# Send mail\n
smtp = SMTP_SSL(smtp_server)\n
smtp.connect(smtp_server, 465)\n
smtp.login(sender_email, password)\n
smtp.sendmail(sender_email, receiver_email, msg.as_string())\n
smtp.quit()\n