Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: cannot send email using outlook #93

Open
acbuyan opened this issue Apr 3, 2024 · 1 comment
Open

BUG: cannot send email using outlook #93

acbuyan opened this issue Apr 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@acbuyan
Copy link

acbuyan commented Apr 3, 2024

Hi everyone,

I'm having trouble automatically sending emails via my Outlook email address using Python. My organisation has MFA enabled, and I do not believe I can turn it off. The code I use is below:

outlook.username = username
outlook.password = password

print("sending email")
outlook.send(
    receivers=["[email protected]"], #NOTE: not email address I'm using, I'm using one that is legitimate
    subject="An example",
    text="Hi, this is an example."
)
print("email sent")

Expected behavior
I'm expecting to see the printed emails

sending email
email sent

Email provider:

  • Email service: Outlook
  • Application to view the email (unsure)

Environment (please complete the following information if relevant):

  • OS: MacOSX
  • Python version 3.11.5
  • Red Mail version 0.6.0
@acbuyan acbuyan added the bug Something isn't working label Apr 3, 2024
@congcong009
Copy link

You may also need to config the smtp information. Better try like this:

from redmail import EmailSender
outlook= EmailSender(host="smtp.office365.com", port=587, username=username, password=password)
outlook.send(
    receivers=["[email protected]"], #NOTE: not email address I'm using, I'm using one that is legitimate
    subject="An example",
    text="Hi, this is an example."
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants