[perl-python] sending email

Discussion in 'Python' started by Xah Lee, Jan 29, 2005.

  1. Xah Lee

    Xah Lee Guest

    # -*- coding: utf-8 -*-
    # Python

    # Suppose you want to spam your friend, and you have lots of
    # friends. The solution is to write a program to do it. After a gander
    # at python docs, one easily found the module for the job.
    # see http://python.org/doc/2.3.4/lib/SMTP-example.html

    # the code is a bit long with the command line, but the key lies at
    # the bottom four lines. The gist is this:

    import smtplib

    smtpServer='smtp.yourdomain.com';
    fromAddr='';
    toAddr='';
    text='''Subject: newfound love

    Hi friend,

    long time no write, i have a new manifesto i
    think it would be of interest for you to peruse.
    ....
    '''

    server = smtplib.SMTP(smtpServer)
    server.set_debuglevel(1)
    server.sendmail(fromAddr, toAddr, text)
    server.quit()


    # save this file as x.py and run it.
    # it should send out the mail.

    # the set_debuglevel() is nice because you see all the interactions
    # with the smtp server. Useful when you want to see what's going on
    # with a smtp server.
    -------------------------
    in Perl, there are not just one, two, or 3 modules that does the job,
    each with slight problems. Here's how the situation stands as of 2001
    March:

    For Perl libraries that deals with RFC 821, I personally know of
    three:

    * Mail::Mailer. Mentioned in most Perl books.
    Written or maintained by Graham Barr.

    * Mail::Send, maintained by Graham Barr , originally
    written by Tim Bunce.

    * Mail::Sendmail by Milivoj Ivkovic.

    The first two has glaring problems. I'm sorry i forgot what they
    are. I think Mail::Mailer has a bug on the from field. i.e. it ignores
    what you gave. I'm currently using Mail::Sendmail, and according to a
    ex-colleague, it has problems with some DNS mail exchange entries.

    for some discussion of the plethora of Perl mail modules and their
    short-cummings, see http://alma.ch/perl/mail.htm
    --------------------
    Xah

    http://xahlee.org/PageTwo_dir/more.html
     
    Xah Lee, Jan 29, 2005
    #1
    1. Advertising

  2. Xah Lee

    Dan Perl Guest

    Dan Perl, Jan 30, 2005
    #2
    1. Advertising

  3. Xah Lee wrote:
    [...]
    > Here's how the situation stands as of 2001 March:

    ^^^^^^^^^^

    Well, at least now we know why Mr. Lee is a little bit behind ....

    jue
     
    Jürgen Exner, Jan 30, 2005
    #3
  4. Jürgen Exner <> wrote:
    > Xah Lee wrote:
    > [...]
    >> Here's how the situation stands as of 2001 March:

    > ^^^^^^^^^^
    >
    > Well, at least now we know why Mr. Lee is a little bit behind ....



    Mr. Lee is a *big* behind!


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jan 30, 2005
    #4
  5. Xah Lee

    YYusenet Guest

    Xah Lee wrote:
    [snip]
    >
    > The first two has glaring problems. I'm sorry i forgot what they

    ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
    > are.

    ^^^^
    [snip]

    How can you complain about *Mail::Mailer* and *Mail::Send* when you
    don't even know what they are?

    --
    k g a b e r t (at) x m i s s i o n (dot) c o m
     
    YYusenet, Jan 30, 2005
    #5
  6. YYusenet wrote:

    > Xah Lee wrote:
    > [snip]
    >>
    >> The first two has glaring problems. I'm sorry i forgot what they

    > ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^
    >> are.

    > ^^^^
    > [snip]
    >
    > How can you complain about *Mail::Mailer* and *Mail::Send* when you
    > don't even know what they are?
    >

    You know, I started to make fun of that, but then decided there was
    nothing I could say that it doesn't say for itself.

    --
    Christopher Mattern

    "Which one you figure tracked us?"
    "The ugly one, sir."
    "...Could you be more specific?"
     
    Chris Mattern, Jan 30, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Luke
    Replies:
    2
    Views:
    4,729
    Nigel Wade
    Mar 15, 2007
  2. rote
    Replies:
    8
    Views:
    777
  3. Lars Roland

    Sending email using perl

    Lars Roland, Nov 15, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    177
    Michele Dondi
    Nov 15, 2004
  4. Kevin B. Pease
    Replies:
    1
    Views:
    356
    A. Sinan Unur
    Nov 19, 2004
  5. Xah Lee

    [perl-python] sending email

    Xah Lee, Jan 29, 2005, in forum: Perl Misc
    Replies:
    5
    Views:
    118
    Steve Holden
    Jan 31, 2005
Loading...

Share This Page