CaesarCloudSync commited on
Commit
0d8e808
·
1 Parent(s): 706f5fe

Email Send Works

Browse files
__pycache__/raspsendemail.cpython-39.pyc ADDED
Binary file (2.57 kB). View file
 
raspsendemail.py CHANGED
@@ -7,7 +7,13 @@ from email.mime.text import MIMEText
7
 
8
  class RaspEmail:
9
  @staticmethod
10
- def send(email,subject,message,attachment=None):
 
 
 
 
 
 
11
  sender_email = "revisionbankedu@gmail.com"
12
  message = MIMEMultipart("alternative")
13
  message["Subject"] = subject
@@ -17,8 +23,7 @@ class RaspEmail:
17
 
18
 
19
  # Turn these into plain/html MIMEText objects
20
- print(message)
21
- part1 = MIMEText(message, "html")
22
 
23
  # Add HTML/plain-text parts to MIMEMultipart message.
24
  # The email client will try to render the last part first
 
7
 
8
  class RaspEmail:
9
  @staticmethod
10
+ def send(**kwargs):
11
+ email,subject,htmlmessage = kwargs["email"],kwargs["subject"],kwargs["message"]
12
+ try:
13
+ attachment = kwargs["attachment"]
14
+ except KeyError as kex:
15
+ attachment = None
16
+ #print(email,subject,message)
17
  sender_email = "revisionbankedu@gmail.com"
18
  message = MIMEMultipart("alternative")
19
  message["Subject"] = subject
 
23
 
24
 
25
  # Turn these into plain/html MIMEText objects
26
+ part1 = MIMEText(htmlmessage, "html")
 
27
 
28
  # Add HTML/plain-text parts to MIMEMultipart message.
29
  # The email client will try to render the last part first
test2.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ from raspsendemail import RaspEmail
2
+
3
+ if __name__ == "__main__":
4
+ email = "amari.lawal@gmail.com"
5
+ message = "Hello World"
6
+ subject = f"RevisionBank Send Now"
7
+ RaspEmail.send(**{"email":email,"message":message,"subject":subject})