On Wed, May 24, 2000 at 04:36:39PM +0530, Shridhar Daithankar wrote:
> Just got RFC 821 and one more thing on TBD list... :-)..

Is this good enough ? smtplib.py in python does it. It's object 
oriented and can be used from Java, if you like.

        -Arun

# Test the sendmail method, which tests most of the others.
# Note: This always sends to localhost.
    import sys, rfc822

    def prompt(prompt):
        sys.stdout.write(prompt + ": ")
        return string.strip(sys.stdin.readline())

    fromaddr = prompt("From")
    toaddrs  = string.splitfields(prompt("To"), ',')
    print "Enter message, end with ^D:"
    msg = ''
    while 1:
        line = sys.stdin.readline()
        if not line:
            break
        msg = msg + line
    print "Message length is " + `len(msg)`

    server = SMTP('localhost')
    server.set_debuglevel(1)
    server.sendmail(fromaddr, toaddrs, msg)
    server.quit()

-----------------------------------------------------------------------
For more information on the LIH mailing list see:
http://lists.linux-india.org/lists/LIH

Reply via email to