By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,427 Members | 1,356 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,427 IT Pros & Developers. It's quick & easy.

socket connection error 10061

P: 1
i am using python smtplib mail server program ,it shows error connection refused target machine not connected 10061

source code
Expand|Select|Wrap|Line Numbers
  1.     import smtplib
  2.     sobj=smtplib.SMTP("smtp.gmail.com")
  3.     sender="abc@gmail.com"
  4.     rec="xyz@gmail.com"
  5.     msg=""hi"
  6.  
  7.     Subject: Test
  8.  
  9.     sobj.sendmail(sender,rec,msg)
Sep 15 '11 #1
Share this Question
Share on Google+
1 Reply


bvdet
Expert Mod 2.5K+
P: 2,851
You may need to login. Your message has a syntax problem.
Expand|Select|Wrap|Line Numbers
  1. import smtplib
  2. sobj=smtplib.SMTP("smtp.abc.com")
  3. sobj.login("username", "password")
  4. sender="abc@xyz.com"
  5. rec="def@zyx.com"
  6. msg="""From: abc@xyz.com
  7. Subject: SMPT test
  8. Text"""
  9. sobj.sendmail(sender,rec,msg)
  10. sobj.quit()
Sep 15 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.