Код: Выделить всё
#!/usr/bin/env python
import sys
def send_mail(number, body, mail_to):
import smtplib
from email.MIMEText import MIMEText
text = 'Hello \r\n'
text += '\r\n call me please ' + str(number)
text += '\r\n' + str(body)
msg = MIMEText(text, "", "utf-8")
msg['Subject'] = '-= recall =- ' + str(number)
msg['From']='xxxx@xxxx'
msg['To'] = mail_to
me='Emilius<xxx@xxx.com>'
mail_to='reception@xxx.ru'
mailSrv=smtplib.SMTP("mail.yandex.ru",25)
mailSrv.ehlo()
mailSrv.login('ncsc@yandex.ru','qwertyuiopsdh')
mailSrv.sendmail(me, mail_to, msg.as_string())
mailSrv.close()
env = {}
while True:
line = sys.stdin.readline().strip()
if line == '':
break
key , data = line.split(':')
key = key.strip()
data = data.strip()
if key <> '':
env[key] = data
callerid = env['agi_callerid']
send_mail(callerid, env, 'reception@xxxx.ru')