How to receive emails with office 365 custom email settings

What I’m trying to do:
I want to receive emails going to just one office 365 account inbox (company account)

What I’ve tried and what’s not working:
I’ve been able to successfully test the connection, to the office 365 smtp server, with Encryption set to None and the email and password for the same email address I want to receive emails for. Testing with STARTTLS Encryption failed, but not immediately (took ~5 seconds before failure was returned) My hunch is that Encryption is required, especially since the account is a company account, not just a personal account. Is this kind of set up possible? Should I be looking more into why STARTTLS Encryption is failing?

If this isn’t possible, is it possible to access an anvil email account’s inbox without having to create UI around it?

Code Sample:
I’m using the same message handling decorator code from the tutorials

p.s. I’m able to send and receive mail for the same office 365 email account with python and django so I’m wondering if it’s something to do with anvil using STARTTLS vs. regular TLS?

Hi @bpersonnel,

SMTP is for receiving emails sent to your app domain (this will usually end with .anvil.app). If you’re trying to access the inbox of an existing Office 365 account, then you’ll need to use the Microsoft APIs.

If this isn’t what you’re after, can you clarify your question?

If there’s no way to use an office 365 email as a custom mail account then that does answer my question. I’ll use my custom anvil domain - not a problem! Thanks!

@brooke is it possible to access my anvil email domain addresses’ inboxes? I want to invite my anvil email to join an Office/Microsoft 365 organization, but I’ll need to be able to access the inbox in order to accept the invite (I’m pretty sure)

Thanks!

One way could be to save the email content to Data Tables this way: Anvil Docs | Sending and Receiving

Then manually find the link and click it.

1 Like

I was able to get an email address at my anvil domain set up as a guest in office 365! Only problem is I’m seeing an error return message when sending mail to an office 365 group that my anvil email address guest is a member of

Here’s the error:

Remote Server returned '554 5.7.190 UnifiedGroupAgent; Recipient excluded because the Microsoft 365 Groups guest feature is disabled.

I’m not sure if this is an error due to something on my end or something on Anvil’s end, but I’m hoping there’s a fix! Thank you so much!

That sounds like a Microsoft 365 issue, not an Anvil issue, like you need to change a setting on the group.