#!/usr/bin/env python
import smtplib
from email.mime.text import MIMEText
textfile = '/path/to/message.txt'
fp = open(textfile, 'rb')
msg = MIMEText(fp.read())
fp.close()
msg['Subject'] = 'The contents of %s' % textfile
msg['From'] = "fromuser@mail.ru"
msg['To'] = "touser@mail.ru"
server = smtplib.SMTP('smtp.mail.ru')
server.login('user','password')
server.sendmail(msg['From'], msg['To'], msg.as_string())
server.quit()