Example #1
0
    def save(self, commit = True):
        smail1 = super(SmailAdminForm,self).save(commit = False)
        mailgroup = ''
        if ((self.cleaned_data['mailgroup'] == 0) or (self.cleaned_data['mailgroup'] == 2)):
            subscribes = Subscribe.objects.all()
            for sub in subscribes:
                mailgroup = mailgroup + sub.mail + ','

        if ((self.cleaned_data['mailgroup'] == 1) or (self.cleaned_data['mailgroup'] == 2)):
            subscribes = Auth.objects.all()
            for sub in subscribes:
                mailgroup = mailgroup + sub.email + ','
        print send_simple_message(mailgroup,self.cleaned_data['subject'],self.cleaned_data['mail'].content)

        if  commit:
            smail1.save()
        return smail1
def decode_response():
    if request.is_json == False:
        raise APIException('The request must be in json format',
                           status_code=400)
    body = request.get_json()
    client_id = None
    print(body)
    for key, value in body.items():
        transaction = Transaction.query.get(key)
        transaction.transaction_description = value
        print("POWW!!!", transaction.serialize())
        client_id = transaction.client_id
    db.session.commit()
    if client_id is not None:
        client = Client.query.get(client_id)
        send_simple_message(
            client.email,
            "Please provide missing details to the transactions listed",
            "Dear client, <br> Below you will find a list of transactions missing information. Please enter the requested details in the fields indicated. <br> Thank you!"
        )
    return "okay", 200
Example #3
0
 def test_send_email(self):
 	"""Test our email sending utility"""
 	self.assertEqual(200,send_simple_message('*****@*****.**',
 		'*****@*****.**','Testing Email',
 		 'Here is the message.')
 	);
Example #4
0
 def test_send_email(self):
     """Test our email sending utility"""
     self.assertEqual(
         200,
         send_simple_message('*****@*****.**', '*****@*****.**',
                             'Testing Email', 'Here is the message.'))