-
Notifications
You must be signed in to change notification settings - Fork 1
/
mail.py
31 lines (24 loc) · 1017 Bytes
/
mail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- coding: utf-8 -*-
# Author: coolrc <[email protected]>
# date: 2021/7/11
"""Description"""
import unittest
from conf import config
from mailer import Mailer
class MailClient:
def __init__(self):
mail_conf = config['mail']
self.mail = Mailer(**mail_conf)
self.send = self.mail.send
# def send_text(self, receiver: str, cc=None, bcc=None, subject: str = None, text: str = None) -> bool:
# return self.mail.send(receiver, cc, bcc, subject, message=text)
#
# def send_html(self, receiver: str, cc=None, bcc=None, subject: str = None, html: str = None) -> bool:
# return self.mail.send(receiver, cc, bcc, subject, html)
class TestMail(unittest.TestCase):
def test_send_mail(self):
client = MailClient()
res = client.send(receiver='[email protected]', # Email From Any service Provider
subject='hi',
html='<h2>HI, This Message From Python :)</h2>')
self.assertTrue(res)