I need to have 'cid' in this script as the subject line in an email. It can't just be in the message body or header, but the actual subject line in the recipient's inbox
import smtplib
cid = raw_input()
cmd = #output from a script
to = 'my@email.com'
m_login = 'recipient@email.com'
m_pwd = 'mypassword'
header = 'To:' + to + '\n' + 'From:' + m_login + '\n' + '\n'
smtpserver = smtplib.SMTP("smtp.outgoingserver.com",587)
smtpserver.ehlo()
smtpserver.ehlo
smtpserver.login(m_login, m_pwd)
mail = header + cmd
smtpserver.sendmail(m_login, to, mail)
smtpserver.close()
The Subject:
header is what's displayed in the recipient's inbox. So your stipulation that this not be in the headers makes no sense at all. Just add it to your headers, e.g.:
header = 'To: %s\nFrom: %s\nSubject: %s\n\n' % (to, m_login, cid)