Exemple #1
0
 def test_send_via_mailgun(self):
     """ Test mailgun """
     eml = Email("MAILGUN")
     status = eml.send_email(from_address='*****@*****.**',
                             to_address='*****@*****.**',
                             subject='MailGun Function test',
                             msg="MailGun Function test")
     self.assertFalse(status)
Exemple #2
0
 def test_send_via_sendgrid(self):
     """ Test Sendgrid """
     eml = Email("SENDGRID")
     status = eml.send_email(from_address='*****@*****.**',
                             to_address='*****@*****.**',
                             subject='SendGrid Function test',
                             msg="SG Function test")
     self.assertFalse(status)
Exemple #3
0
 def test_send_via_aws_send_email(self):
     """ Test AWSSES Direct mail """
     eml = Email("AWSSES")
     ret = eml.send_email(
         from_address='*****@*****.**',
         to_address='*****@*****.**',
         subject='AWS FUNC Test',
         msg=" AWS Func Test ",
     )
     self.assertFalse(ret)
Exemple #4
0
def sendmail():
    data = app.current_request.json_body
    eml = Email(data['service_provider'])
    ret = {}
    ret = eml.send_email(
        from_address=data['sender'],
        to_address=data['recipient'],
        subject=data['subject'],
        msg=data['body'],
    )
    print(ret)
    return f'Message send: {ret}', 201
Exemple #5
0
def index():
    if not request.json:
        abort(400)
    data = request.json
    eml = Email(data['service_provider'])
    ret = {}
    ret = eml.send_email(
        from_address=data['sender'],
        to_address=data['recipient'],
        subject=data['subject'],
        msg=data['body'],
    )
    print(ret)
    return f'Message send: {ret}', 201
Exemple #6
0
def sendmailaws():
    data = app.current_request.json_body
    eml = Email(data['service_provider'])
    ret = {}
    ret = eml.send_email(
        aws_smptp_host=data['aws_smptp_host'],
        aws_smptp_port=data['aws_smptp_port'],
        aws_smpt_user=data['aws_smpt_user'],
        aws_smpt_passwd=data['aws_smpt_passwd'],
        from_address=data['sender'],
        to_address=data['recipient'],
        subject=data['subject'],
        msg=data['body'],
    )
    print(ret)
    return f'Message AWS Mail send: {ret}', 201
Exemple #7
0
def send_mailaws():
    if not request.json:
        abort(400)
    data = request.json
    eml = Email(data['service_provider'])
    ret = {}

    ret = eml.send_seperate_mail_aws(aws_smptp_host=data['aws_smptp_host'],
                                     aws_smptp_port=data['aws_smptp_port'],
                                     aws_smpt_user=data['aws_smpt_user'],
                                     aws_smpt_passwd=data['aws_smpt_passwd'],
                                     from_address=data['sender'],
                                     to_address=data['recipient'],
                                     subject=data['subject'],
                                     body=data['body'])
    print(ret)
    return f'AWS Message send: {ret}', 201