reg email packages work

Discussion in 'Python' started by praba kar, Aug 29, 2005.

  1. praba kar

    praba kar Guest

    Dear All,

    I am working in web based email system project.
    Here I try to build email message
    from scratch. I used below code to build email
    message

    msg = email.MIMEBase('text','html')
    msg['Return-Path'] = user+'@'+domain
    msg['Date'] = formatdate(localtime=1)
    msg['Subject'] = subject
    msg['From'] = from_name
    msg['To'] = to
    msg['Cc'] = cc
    msg.set_payload("Body of the email messagge")
    fh = os.popen('/bin/sendmail %s'% (eachid),'w')
    fh.write(msg.as_string())
    fh.close()

    This code will build plain email message properly.
    But after building the message. If a email user
    download this mail through out look express then
    this email message will display without any alignment.
    If a user type 3 paragraph message
    outlook express display as a single line. What
    could be problem?. Kindly let me know ASAP

    regards
    Prabahar



    __________________________________________________________
    How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com
     
    praba kar, Aug 29, 2005
    #1
    1. Advertising

  2. praba kar

    Tim Roberts Guest

    praba kar <> wrote:
    >
    > I am working in web based email system project.
    >Here I try to build email message
    >from scratch. I used below code to build email
    >message
    >
    > msg = email.MIMEBase('text','html')
    > msg['Return-Path'] = user+'@'+domain
    > msg['Date'] = formatdate(localtime=1)
    > msg['Subject'] = subject
    > msg['From'] = from_name
    > msg['To'] = to
    > msg['Cc'] = cc
    > msg.set_payload("Body of the email messagge")
    > fh = os.popen('/bin/sendmail %s'% (eachid),'w')
    > fh.write(msg.as_string())
    > fh.close()
    >
    >This code will build plain email message properly.


    No, it doesn't. It builds an HTML message (see the very first line). If
    you supply plain text to this as the body of the message, all the lines
    will be concatenated together, which sounds a lot like what you are seeing.

    If you are not feeding HTML as the body, change the fist line to
    ('text','plain').
    --
    - Tim Roberts,
    Providenza & Boekelheide, Inc.
     
    Tim Roberts, Sep 2, 2005
    #2
    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. Paul  Smith
    Replies:
    0
    Views:
    742
    Paul Smith
    Nov 18, 2003
  2. praba kar

    reg packages examples

    praba kar, Aug 23, 2005, in forum: Python
    Replies:
    0
    Views:
    268
    praba kar
    Aug 23, 2005
  3. praba kar

    Reg Python Modules/Packages

    praba kar, Aug 24, 2005, in forum: Python
    Replies:
    0
    Views:
    237
    praba kar
    Aug 24, 2005
  4. Steve Holden

    Re: reg email packages work

    Steve Holden, Aug 29, 2005, in forum: Python
    Replies:
    4
    Views:
    277
    Robert Kern
    Aug 31, 2005
  5. David Lyon
    Replies:
    19
    Views:
    596
    David Lyon
    Apr 24, 2009
Loading...

Share This Page