#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    11
    Rep Power
    0

    How to add subject in this code ?


    Code:
    import smtplib
    import urllib2
    
    
      
    fromaddr = 'someone@d.com'  
    toaddrs  = ['someone@d.com']  
    
    msg = '!!Only test!!'  
      
      
    # Credentials (if needed)  
    username = 'someone@d.com'  
    password = '12345'  
      
    # The actual mail send  
    server = smtplib.SMTP('smtp.gmail.com:587')  
    server.starttls()  
    server.login(username,password)  
    server.sendmail(fromaddr, toaddrs, msg)  
    server.quit()
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,647
    Rep Power
    1945
    How will it look if you have have this example:
    Code:
    Subject: Test
    This is the standard text
    like this:
    Code:
    msg = "Subject: Test\n\nThis is the standard text"
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    11
    Rep Power
    0

    After checking I will reply thanks for your reply.


    Originally Posted by MrFujin
    How will it look if you have have this example:
    Code:
    Subject: Test
    This is the standard text
    like this:
    Code:
    msg = "Subject: Test\n\nThis is the standard text"
    Thanks.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    11
    Rep Power
    0

    Very Very Thank you .


    Originally Posted by peter_england
    Thanks.
    Thanks its worked perfectly .. thanks again
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    11
    Rep Power
    0

    One more Help please .


    Originally Posted by peter_england
    Thanks its worked perfectly .. thanks again
    Actually I want to Add A Mysql query output in that mail message ..
    My query is Below.

    Code:
    query = ("set @now=now();select * from EMPMASTER where (month(DOB) = month(@now) and day(DOB) = day(@now)) or(month(DOB) = 2 and day(DOB) = 29 and month(@now) = 2 and day(@now) = 28 and month(date_add(@now, interval 1 day)) = 3);")
    and i need to use this Code for that

    Code:
    import MySQLdb
    
    db = MySQLdb.connect(host="localhost", # your host, usually localhost
                         user="root", # your username
                          passwd="12345", # your password
                          db="emp") # name of the data base
    Thanks in advance.

IMN logo majestic logo threadwatch logo seochat tools logo