Oh yes, you need to define subject up near the top of the script and
change the final call to send_mail().
Eg:
import smtplib
import os
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders

myRelease = os.environ.get("BUILD_STRING")
files=["myData.xml","myDataNightly_Previous.xml","myDataRelease_Previous.xml",
"myReport.html"]
to=["an.ema...@address.com","an.ema...@address.com","an.ema...@address.com"]
text1 = "To everyone\n\nmyData.xml has changed following the latest
build :- "
text2 = myRelease
text3 = "\r\n\nSee attached files\r\n\r\nReleases are in\"\\\\netdrive
\Product source code\Tagged\", \r\n\nNightly files are in \"\\\
\netdrive\Product source code\Nightly\"\r\n\nRegards,\r\n\nJenkins\r
\n"
text = text1+text2+text3
subject="myNewEmailSubject"

# Send the email via our own SMTP server.
def send_mail(to, subject, text, fromWho="", files=[], cc=[], bcc=[],

etc etc

send_mail(to, subject, text, "jenkins", files)

Reply via email to