← Back to team overview

sikuli-driver team mailing list archive

[Question #287970]: issue regarding smtplib for python script in sikulix

 

New question #287970 on Sikuli:
https://answers.launchpad.net/sikuli/+question/287970

Hi 

 I have written python script for sending a mail. and I am running the script in Sikulix IDE. I am getting the following error:

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[error] script [ Untitled ] stopped with error in line 7
[error] _socket.gaierror ( [Errno 20001] getaddrinfo failed )
[error] --- Traceback --- error source first line: module ( function ) statement 359: _socket ( handle_exception ) _socket.gaierror: [Errno 20001] getaddrinfo failed
291: smtplib ( _get_socket ) File "C:\Sikulix\sikulix.jar\Lib\_socket.py", line 1487, in create_connection
256: smtplib ( __init__ ) File "C:\Sikulix\sikulix.jar\Lib\smtplib.py", line 316, in connect
[error] --- Traceback --- end --------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here following is the code:

it is showing error at line 7 : (server = smtplib.SMTP('smpt.gmail.com',587))
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
import smtplib
To = 'recievermailaddress@xxxxxxxxx'
SUBJECT = 'Send email'
TEXT = 'Here is email content'
gmail_sender='sendermailaddress@xxxxxxxxx'
gmail_password='senderpassword'
server = smtplib.SMTP('smpt.gmail.com',587)
server.ehlo()
server.starttls()
server.ehlo
server.login(gmail_sender,gmail_password)
BODY = '\r\n'.join([
       'To:%s'%To,
       'From:%s'%gmail_sender,
       'Subject:%s'%SUBJECT,
       '',
       TEXT
       ])
try:
    server.sendmail(gmail_sender,[TO],BODY)
    print 'email sent'
except:
    print 'eror'

server.quit()
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


PLease help...... :(

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.