PEATSA/WebApp/UtilityFunctions.py
def SendNotificationEmail(job):

	'''Sends an email to the address associated with job is done

	Note: A mail is only sent if no previous mail has been sent.

	Parameters:
	job - A WebApp.Data.Job instance representing a PEATSA job

	'''

	if job.isEmailSent():
		return

	import smtplib
	from email.MIMEText import MIMEText
	from email.MIMEMultipart import MIMEMultipart

	message = MIMEMultipart()
	message['From'] = 'peatadmin@ucd.ie'
	message['Reply-To'] = 'peatadmin@ucd.ie'
	message['To'] = job.email()

	if job.error() is None:
		message['Subject'] = 'PEATSA Job Finished'
		text = "Your job has finished.\n\n"
		text = text + "See http://enzyme.ucd.ie/PEATSA/Pages/Results.php?jobId=%s" % job.identification
	else:
		message['Subject'] = 'PEATSA Job Error'
		text = "Unfortunately we encountered an error when running your job.\n\n"
		text = text + "Please see http://enzyme.ucd.ie/PEATSA/Pages/Results.php?jobId=%s for more information." % job.identification
			
	text = text + "\n\nRegards,\n\tThe PEAT-SA developers."

	bodyText = MIMEText(text)
	message.attach(bodyText)

	# Send the email
	try:
		server=smtplib.SMTP('mail.ucd.ie')
		server.sendmail('peatadmin@ucd.ie',job.email(),message.as_string())
		server.quit()  
	except Exception, data:
		print 'Exception sending emaili to', job.email()
		print data

	job.setEmailSent()
Sends an email to the address associated with job is done

	Note: A mail is only sent if no previous mail has been sent.

	Parameters:
	job - A WebApp.Data.Job instance representing a PEATSA job

	
Sends an email to the address associated with job is done
Note: A mail is only sent if no previous mail has been sent.

A WebApp.Data.Job instance representing a PEATSA job
Sends an email to the address associated with job is done Note : A mail is only sent if no previous mail has been sent . A WebApp . Data . Job instance representing a PEATSA job
def SendNotificationEmail(job):
	if job.isEmailSent():
		return
	import smtplib
	from email.MIMEText import MIMEText
	from email.MIMEMultipart import MIMEMultipart
	message = MIMEMultipart()
	message['From'] = 'peatadmin@ucd.ie'
	message['Reply-To'] = 'peatadmin@ucd.ie'
	message['To'] = job.email()
	if job.error() is None:
		message['Subject'] = 'PEATSA Job Finished'
		text = "Your job has finished.\n\n"
		text = text + "See http://enzyme.ucd.ie/PEATSA/Pages/Results.php?jobId=%s" % job.identification
	else:
		message['Subject'] = 'PEATSA Job Error'
		text = "Unfortunately we encountered an error when running your job.\n\n"
		text = text + "Please see http://enzyme.ucd.ie/PEATSA/Pages/Results.php?jobId=%s for more information." % job.identification
	text = text + "\n\nRegards,\n\tThe PEAT-SA developers."
	bodyText = MIMEText(text)
	message.attach(bodyText)
	try:
		server=smtplib.SMTP('mail.ucd.ie')
		server.sendmail('peatadmin@ucd.ie',job.email(),message.as_string())
		server.quit()  
	except Exception, data:
		print 'Exception sending emaili to', job.email()
		print data
	job.setEmailSent()
def SendNotificationEmail ( job ) : if job . isEmailSent ( ) : return import smtplib from email . MIMEText import MIMEText from email . MIMEMultipart import MIMEMultipart message = MIMEMultipart ( ) message [ 'From' ] = 'peatadmin@ucd.ie' message [ 'Reply-To' ] = 'peatadmin@ucd.ie' message [ 'To' ] = job . email ( ) if job . error ( ) is None : message [ 'Subject' ] = 'PEATSA Job Finished' text = "Your job has finished.\n\n" text = text + "See http://enzyme.ucd.ie/PEATSA/Pages/Results.php?jobId=%s" % job . identification else : message [ 'Subject' ] = 'PEATSA Job Error' text = "Unfortunately we encountered an error when running your job.\n\n" text = text + "Please see http://enzyme.ucd.ie/PEATSA/Pages/Results.php?jobId=%s for more information." % job . identification text = text + "\n\nRegards,\n\tThe PEAT-SA developers." bodyText = MIMEText ( text ) message . attach ( bodyText ) try : server = smtplib . SMTP ( 'mail.ucd.ie' ) server . sendmail ( 'peatadmin@ucd.ie' , job . email ( ) , message . as_string ( ) ) server . quit ( ) except Exception , data : print 'Exception sending emaili to' , job . email ( ) print data job . setEmailSent ( )
Sends an email to the address associated with job is done
Note: A mail is only sent if no previous mail has been sent.
Sends an email to the address associated with job is done Note : A mail is only sent if no previous mail has been sent .
'''Sends an email to the address associated with job is done

	Note: A mail is only sent if no previous mail has been sent.

	Parameters:
	job - A WebApp.Data.Job instance representing a PEATSA job

	''' # Send the email
job