Python for email?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sean

    Python for email?

    Is there a good module for sending out email?

    For a website that I am working on, I am writing a program that finds out
    which presenters have not yet confirmed their scheduled date and sends them
    an email to confirm.

    Does python have any modules for use with mail programs like sendmail, or
    should I just run everything with os.system and os.popen?

    Thanks for any help.


  • Brett Kelly

    #2
    Re: Python for email?

    On Fri, 26 Mar 2004 17:16:29 -0800, sean wrote:
    [color=blue]
    > Is there a good module for sending out email?
    >
    > For a website that I am working on, I am writing a program that finds out
    > which presenters have not yet confirmed their scheduled date and sends them
    > an email to confirm.
    >
    > Does python have any modules for use with mail programs like sendmail, or
    > should I just run everything with os.system and os.popen?
    >
    > Thanks for any help.[/color]

    Check out smtplib, it should do what you want

    Good Luck,
    Brett

    Comment

    • Skip Montanaro

      #3
      Re: Python for email?


      sean> Is there a good module for sending out email?

      Check out smtplib in the standard library:



      Skip

      Comment

      • Cameron Laird

        #4
        Re: Python for email?

        In article <mailman.472.10 80396882.742.py thon-list@python.org >,
        Skip Montanaro <skip@pobox.com > wrote:[color=blue]
        >
        > sean> Is there a good module for sending out email?
        >
        >Check out smtplib in the standard library:
        >
        > http://www.python.org/doc/current/li...e-smtplib.html
        >
        >Skip
        >[/color]

        'Past time that I mention this: I'm a big fan of the smtplib module.
        In general, I think this is the direction Python-oriented developers
        should take, and NOT to "shell out" to sendmail or such. However,
        one benefit of sendmail and comparable MTAs that's often not immedi-
        ately apparent (and, with any luck, won't be for the life of any
        specific project) is their knowledge about retries. Projects that
        face erratic connectivity either need to exploit an installed MTA,
        or program their own retry management.

        smtplib presents a few other, even more marginal issues. If an
        installed MTA enforces institutional standards (disclaimers, archi-
        ving, ...), smtplib is likely to subvert those. Decide for yourself
        if that's a good or bad thing.
        --

        Cameron Laird <claird@phaseit .net>
        Business: http://www.Phaseit.net

        Comment

        • Kyler Laird

          #5
          Re: Python for email?

          claird@lairds.c om (Cameron Laird) writes:
          [color=blue]
          >smtplib presents a few other, even more marginal issues. If an
          >installed MTA enforces institutional standards (disclaimers, archi-
          >ving, ...), smtplib is likely to subvert those.[/color]

          How so?

          The example for smtplib given here

          appears to relay mail through "localhost" . That will typically be
          equivalent to using the "installed MTA", right?

          --kyler

          Comment

          • Cameron Laird

            #6
            Re: Python for email?

            In article <mqtgj1-ik6.ln1@snout.l airds.org>,
            Kyler Laird <Kyler@news.Lai rds.org> wrote:[color=blue]
            >claird@lairds. com (Cameron Laird) writes:
            >[color=green]
            >>smtplib presents a few other, even more marginal issues. If an
            >>installed MTA enforces institutional standards (disclaimers, archi-
            >>ving, ...), smtplib is likely to subvert those.[/color]
            >
            >How so?
            >
            >The example for smtplib given here
            > http://www.python.org/doc/current/lib/SMTP-example.html
            >appears to relay mail through "localhost" . That will typically be
            >equivalent to using the "installed MTA", right?
            >
            >--kyler[/color]

            All true, and by neglecting to read the manual recently, I've
            confused things. Thanks for the correction.

            *I* have the habit of doing something that I now see the smtplib
            documentation does not recommend--'fact, I now suspect that it
            never did, and that it's my own memory that introduced all the
            problems. Here's what I should have written before:
            smtplib is great. If you get in the habit of using
            it to connect directly to the far endpoint, as I do,
            you risk the surprise of finding situations where a
            local MTA is an advantage. In any case, though,
            smtplib can always be configured do at least as much
            for you as shelling out to a local mailer.
            --

            Cameron Laird <claird@phaseit .net>
            Business: http://www.Phaseit.net

            Comment

            • jmdeschamps

              #7
              Re: Python for email?

              "sean" <sean_berry@cox .net> wrote in message news:<SB49c.476 41$Bg.20541@fed 1read03>...[color=blue]
              > Is there a good module for sending out email?
              >
              > For a website that I am working on, I am writing a program that finds out
              > which presenters have not yet confirmed their scheduled date and sends them
              > an email to confirm.
              >
              > Does python have any modules for use with mail programs like sendmail, or
              > should I just run everything with os.system and os.popen?
              >
              > Thanks for any help.[/color]

              .... and using imaplib, you could *listen* to an email account for
              confirmations and thus, know if the confirm info as reached the
              presenters brain !-)

              jean-marc
              Spring is in the air

              Comment

              • sean

                #8
                Re: Python for email?

                Thanks you all for the info. That is exacly what I was looking for.


                "jmdeschamp s" <jmdeschamps@cv m.qc.ca> wrote in message
                news:3d06fae9.0 403271139.701d1 a5e@posting.goo gle.com...[color=blue]
                > "sean" <sean_berry@cox .net> wrote in message[/color]
                news:<SB49c.476 41$Bg.20541@fed 1read03>...[color=blue][color=green]
                > > Is there a good module for sending out email?
                > >
                > > For a website that I am working on, I am writing a program that finds[/color][/color]
                out[color=blue][color=green]
                > > which presenters have not yet confirmed their scheduled date and sends[/color][/color]
                them[color=blue][color=green]
                > > an email to confirm.
                > >
                > > Does python have any modules for use with mail programs like sendmail,[/color][/color]
                or[color=blue][color=green]
                > > should I just run everything with os.system and os.popen?
                > >
                > > Thanks for any help.[/color]
                >
                > ... and using imaplib, you could *listen* to an email account for
                > confirmations and thus, know if the confirm info as reached the
                > presenters brain !-)
                >
                > jean-marc
                > Spring is in the air[/color]


                Comment

                • Donn Cave

                  #9
                  Re: Python for email?

                  Quoth claird@lairds.c om (Cameron Laird):
                  | ... Here's what I should have written before:
                  | smtplib is great. If you get in the habit of using
                  | it to connect directly to the far endpoint, as I do,
                  | you risk the surprise of finding situations where a
                  | local MTA is an advantage. In any case, though,
                  | smtplib can always be configured do at least as much
                  | for you as shelling out to a local mailer.

                  Of course there's no guarantee that a connection to localhost
                  is going to work, either - not all hosts accept incoming mail.
                  But it probably isn't a great idea to try to send it right to
                  the recipient's doorstep, especially if you're not prepared to
                  look up DNS MX records.

                  Some sites provide a host just for this purpose, for use by
                  desktop mail software and other similar applications.

                  Donn Cave, donn@drizzle.co m

                  Comment

                  • Chris Green

                    #10
                    Re: Python for email?

                    claird@lairds.c om (Cameron Laird) writes:
                    [color=blue]
                    > However, one benefit of sendmail and comparable MTAs that's often
                    > not immedi- ately apparent (and, with any luck, won't be for the
                    > life of any specific project) is their knowledge about retries.[/color]

                    A good argument against MTAs when doing an application for deployment
                    with less than knowledgable sysadmins that pick a default linux box
                    and do an install just to get your system up on running on their
                    intranet.

                    When their email doesn't work for one of a myriad of reasons (FQDN,
                    relay configuration, odd internal MX records) you're left supporting
                    them or telling them to find support for some piece of software more
                    complex than what you probably gave them.

                    I got reminded of this yet again when I tried to do a VERY quick
                    install of bugzilla a few months ago.

                    Getting them to enter an IP and then on the phone telling them to do
                    telnet host 25 is a much easier thing to debug.
                    --
                    Chris Green <cmg@dok.org>
                    A good pun is its own reword.

                    Comment

                    • Anand K Rayudu

                      #11
                      Python &amp; COM

                      Hi all,

                      I have a very primitive question about Python & COM interface.
                      As of now I have not got any good documentation on using it.
                      I am planning to buy Python programming on win32 book.
                      [ It will reach me only after 2 days :-( ]

                      Could some one please suggest how to add one COM interface which takes
                      int array as input.
                      precisely I want to do following

                      a=[]
                      a.append(100)
                      a.append(200)

                      from win32com.client import Dispatch


                      o=Dispatch("MyA ppl.com")
                      o.setIntArray(l en(a),a)
                      I am expecting in my COM interface, I will get VARIENT of SAFEARRAY .

                      in ATL com implementation,


                      SAFEARRAY *array=V_ARRAY( a);
                      long i,val;
                      for(i=0;i<len;i ++){
                      SafeArrayGetEle ment(array,&i,& val)
                      c_array[i]= val;
                      }

                      I am not getting proper values in C array.
                      Any suggestions?

                      Regards,
                      Anand



                      Comment

                      Working...