Example #1
0
    def test_missing_values(self):
        message = Message()
        self.assertRaises(ValueError, str, message)

        message.author = "*****@*****.**"
        self.assertRaises(ValueError, str, message)

        message.subject = "Attn: Bob Dole"
        self.assertRaises(ValueError, str, message)

        message.to = "*****@*****.**"
        self.assertRaises(ValueError, str, message)

        message.plain = "Testing!"

        try:
            str(message)
        except ValueError:
            self.fail("Message should be valid.")
 def test_missing_values(self):
     message = Message()
     self.assertRaises(ValueError, str, message)
     
     message.author = "*****@*****.**"
     self.assertRaises(ValueError, str, message)
     
     message.subject = "Attn: Bob Dole"
     self.assertRaises(ValueError, str, message)
     
     message.to = "*****@*****.**"
     self.assertRaises(ValueError, str, message)
     
     message.plain = "Testing!"
     
     try:
         str(message)
     except ValueError:
         self.fail("Message should be valid.")
Example #3
0
	def test_missing_values(self):
		message = Message()
		with pytest.raises(ValueError):
			unicode(message)
		
		message.author = "*****@*****.**"
		with pytest.raises(ValueError):
			unicode(message)
		
		message.subject = "Attn: Bob Dole"
		with pytest.raises(ValueError):
			unicode(message)
		
		message.to = "*****@*****.**"
		with pytest.raises(ValueError):
			unicode(message)
		
		message.plain = "Testing!"
		
		try:
			unicode(message)
		except ValueError:
			assert False, "Message should be valid."
Example #4
0
    def test_missing_values(self):
        message = Message()
        with pytest.raises(ValueError):
            unicode(message)

        message.author = "*****@*****.**"
        with pytest.raises(ValueError):
            unicode(message)

        message.subject = "Attn: Bob Dole"
        with pytest.raises(ValueError):
            unicode(message)

        message.to = "*****@*****.**"
        with pytest.raises(ValueError):
            unicode(message)

        message.plain = "Testing!"

        try:
            unicode(message)
        except ValueError:
            assert False, "Message should be valid."
Example #5
0
logging.basicConfig(level=logging.INFO)


configuration = {
    "manager": "immediate",  # futures
    "manager.workers": 5,
    "transport": "smtp",
    "transport.host": "",
    "transport.tls": "ssl",  # None=='', required, optional
    "transport.port": 465,  # 25, 465 = SSL
    "transport.username": "",
    "transport.password": "",
    "transport.max_messages_per_connection": 5,
    "transport.debug": False,
}


if __name__ == "__main__":
    mail = Delivery(configuration)
    mail.start()

    message = Message()
    message.author = [("Alice Bevan-McGregor", "*****@*****.**")]
    message.to = [("Your Name Here", "*****@*****.**")]
    message.subject = "This is a test message."
    message.plain = "Testing!"

    mail.send(message)
    mail.stop()