Пример #1
0
	def testSendEmail( self ):
		# force loading settings from configuration files
		mApp().getSettings().evalConfigurationFiles()

		email = Email()
		email.setToAddresses( ['*****@*****.**'] )
		email.setFromAddress( mApp().getSettings().get( Settings.EmailReporterSender ) )

		email.setSubject( 'EmailerTest email' )

		email.attachAlternativeTextPart(
		'''\
		This is a test email sent by Make-O-Matic.
		Check it out at http://github.com/KDAB/Make-O-Matic
		''',
		"""\
		<html>
			<head>Make-O-Matic Test Email</head>
			<body>
				<p>This is the HTML part of the test email<br>
					 Check out Make-O-Matic at <a href="http://github.com/KDAB/Make-O-Matic">GitHub</a>.
				</p>
			</body>
		</html>
		""" )

		attachmentText = "TEST:\n" + "\n".join( sys.path )
		email.addTextAttachment( attachmentText, "testfile1.txt", False )
		email.addTextAttachment( attachmentText, "testfile2.txt", True )

		e = Emailer( 'Emailer' )
		e.setup()
		e.send( email )
		e.quit()
Пример #2
0
	def notify( self ):
		assert isinstance( mApp(), Build )

		email = self.createEmail()

		if len( email.getToAddresses() ) == 0:
			mApp().debug( self, 'Not sending mail, no recipients added' )
			return

		# send mail, this may throw an exception
		e = Emailer()
		e.setup()
		e.send( email )
		e.quit()
		mApp().debug( self, 'Sent E-Mail to following recipients: {0}'.format( ", ".join( email.getToAddresses() ) ) )
		self._setIsReportSent( True )