smtplib

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • askalottaqs
    New Member
    • Jun 2007
    • 75

    smtplib

    Hello people!

    I have a little problem here sending an email using python, I have never worked with smtp, not my field at all, I know i need to setup a listener or something on my computer in order to be able to send an email, now i know this code should be able to send the email


    import smtplib

    s = smtplib.SMTP('l ocalhost')
    s.sendmail('fal seemail@nothing .com', 'recipient@host .com, 'hi there!')
    s.quit()



    but i get this error message

    AttributeError: 'module' object has no attribute '__path__'


    I think it's something to do with the smtp setup on my own machine, could anyone help me please?

    Thanks a bunch
  • numberwhun
    Recognized Expert Moderator Specialist
    • May 2007
    • 3467

    #2
    Any chance you could tell us what OS you are on first?

    Regards,

    Jeff

    Comment

    • askalottaqs
      New Member
      • Jun 2007
      • 75

      #3
      oops, Windows XP SP2

      Comment

      • kaarthikeyapreyan
        New Member
        • Apr 2007
        • 106

        #4
        Check if your configured mail Server is listening at port 25, that port is associated with the internet operations. if u r not able to configure your mail server to that port check if there in already an SMTP service running at that port.
        your code worked fine for me
        Code:
        >>> import smtplib
        >>> s= smtplib.SMTP('localhost')
        >>> s.sendmail('xxx@mydomain.com','yyy@gmail.com','smtp Mail')
        {}
        >>> s.quit()

        Comment

        Working...