Miksus/red-mail

Documentation enhancement: Outlook

gamesbook opened this issue · 3 comments

Outlook is a commonly used email client; an example showing how to configure RedMail to use this would be great.

Thanks for the suggestion! Actually I made a quick test, it seems Outlook works even with less setup than Gmail:

email = EmailSender(
    host='smtp.office365.com',
    port=587,
    user_name='me@hotmail.com',
    password='<YOUR PASSWORD>'
)
email.send(
    receivers=["you@example.com"],
    subject="Example email",
    html='<p>An example</p>',
)

In addition, I think there could be a similar partially configured sender as the gmail object, like:

from redmail import outlook

outlook.user_name = 'me@hotmail.com'
outlook.password = '<PASSWORD>'

outlook.send(...)

As sending emails from Outlook is common enough. Seems pretty simple.

That seems simple, thanks!

For Outlook, it does seem the port may change, depending on local IT setup, so it would be useful to be able to set that too if needed.

No problem and thanks for the info! Indeed it seems Outlook may use 993 or 995 ports for SSL. By default, Red Mail uses STARTTLS which is indeed meant for port 587. Red Mail also supports SSL in case that's what is needed: see this.

The port is just an attribute so you are free to change it to anything that works for you simply by:

outlook.port = 993

However, in this case you should probably also set outlook.cls_smtp to smtplib.SMTP_SSL as that is SSL port. I'll write a couple of words more about this to the PR.