I want to send a warning email to a user. In my company we have an exchange server, but I dont have a dedicated account for my app. So, I would like to send a message with a noreply sender or an invented sender. Is it possible? How to config the credentials/Account?
This is the code I have, but it needs to use some user's account. I would like to avoid using user's account.
from exchangelib import DELEGATE, Account, Credentials, Configuration, Message, Mailbox
creds = Credentials(
username="DOMAIN\\my.login",
password="")
config = Configuration(server='server.company.com', credentials=creds)
account = Account(
primary_smtp_address="myemail@company.com",
autodiscover=False,
config = config,
access_type=DELEGATE)
m = Message(
account=account,
subject='Daily',
body='BOdy test',
to_recipients=[
Mailbox(email_address='recip@test.com'),
],
cc_recipients=['cc_recip@test.com'],
bcc_recipients=[
Mailbox(email_address='bcc_recip@test.com'),
],
)
m.send()