Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #-*-coding: utf-8 -*-
- from email.MIMEText import MIMEText
- import smtplib
- import sys
- sender = 'test@domain.local' # От кого
- recivers = 'test2@domain.local' # Кому
- text = sys.argv[1]
- msg = MIMEText(text, "", "utf-8")
- msg["Subject"] = "Уведомление о пропущенном вызове"
- smtpObj = smtplib.SMTP('ex.domain.ru', 25)
- smtpObj.ehlo()
- smtpObj.starttls()
- smtpObj.login('test', '!Q2w3e4r-2015')
- smtpObj.sendmail(sender, recivers, msg.as_string())
- smtpObj.close()
- [root@pbx-o ~]# python /usr/local/bin/sendmail.py qweqweq
- Traceback (most recent call last):
- File "/usr/local/bin/sendmail.py", line 21, in <module>
- smtpObj.login('test', '!Q2w3e4r-2015')
- File "/usr/lib64/python2.7/smtplib.py", line 584, in login
- raise SMTPException("SMTP AUTH extension not supported by server.")
- smtplib.SMTPException: SMTP AUTH extension not supported by server.
Add Comment
Please, Sign In to add comment