In Mid 2022 Microsoft shut down all it’s SMTP and POP servers due to security concerns. The protocols are old and IMAP is more secure they said. I thought I could send email with an attachment using IMAP but after using Gemini AI how to do this, it says IMAP is not intended to do that.
How do I send email these days using Python if I cannot use IMAP or SMTP? Also I will not have a security certificate, I’m on my own for this task.
As far as I know you must use SMTP to send emails.
I search of the web also seems to confirm this.
IMAP is only for accessing the mailboxes on a server unless
Microsoft has an extension maybe?
I’m not a o365 user anymore, but when I was the IT people could turn on and off features.
You might like to ask your IT people if it is possible to enable SMTP for an account you control, maybe not your main account.
Thanks everyone. IT told me of a different SMTP server that was still active (ie. we still paid for it), but I didn’t know about it. So I used that one and got it working.
However smtplib didn’t work as it requires the programmer to create the email headers themselves, which I didn’t know how to do. The program would not get errors but I would not get the email I sent myself either. This I turned into its own function.
So I got it working using from email import utils. This I turned into its own function. This import line will help you search for the page I got the example from.