Skip to content

Commit

Permalink
added bcc and cc function to Imap
Browse files Browse the repository at this point in the history
bcc and cc works now for sending Imap emails
  • Loading branch information
Mephisto2409 committed Nov 26, 2024
1 parent 9c97718 commit 0e8a51c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions EMailService.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def sendEmail(self, email:Email) -> bool:
msg = EmailMessage()
msg['Subject'] = email.subject
msg['From'] = from_email
msg['To'] = to_emails[0]
msg['To'] = to_emails
msg['Cc'] = cc
msg['Bcc'] = bcc
msg.set_content(email.body)

#attachment
Expand Down Expand Up @@ -271,7 +273,7 @@ def imap_test():
test = Email(

subject="Hello",
body="World",
body="World i wanna go home",
recipients=[EmailReception(contact=(Contact(email_address ="praxisprojekt-remail@uni-due.de")), kind=RecipientKind.to)],
attachments=[Attachment(filename=r"C:\Users\toadb\Documents\ReinventingEmail\test.txt")])

Expand All @@ -293,18 +295,18 @@ def exchange_test():


#exchange
import keyring
#import keyring

test = Email(

subject="Betreff",
body="World",
recipients=[EmailReception(contact=(Contact(email_address ="thatchmilo35@gmail.com")), kind=RecipientKind.to)],
recipients=[EmailReception(contact=(Contact(email_address ="thatchmilo35@gmail.com")))],
attachments=[Attachment(filename="path")])


print("Exchange Logged_in: ",exchange.logged_in)
exchange.login("praxisprojekt-remail@uni-due.de",keyring.get_password("remail/exchange","praxisprojekt-remail@uni-due.de"))
#exchange.login("praxisprojekt-remail@uni-due.de",keyring.get_password("remail/exchange","praxisprojekt-remail@uni-due.de"))
print("Exchange Logged_in: ",exchange.logged_in)
emails = exchange.getEmails()
#exchange.sendEmail(test)
Expand Down Expand Up @@ -335,8 +337,8 @@ def get_contact(email : str) -> Contact:

if __name__ == "__main__":
print("Starte Tests")
#imap_test()
exchange_test()
imap_test()
#exchange_test()
print("Tests beendet")


Expand Down

0 comments on commit 0e8a51c

Please sign in to comment.