Sending email from an app you built yourself
Apps do not send email directly; they hand it to a sending service. The reason your first attempt lands in spam is that nothing has yet proved you are allowed to send as your domain. Three DNS records fix that, and until they exist your messages are treated as suspicious.
What the receiving side is checking
- Is this sender permitted to send for this domain?
- Is the message signed in a way that matches the domain?
- Does the domain say what to do with messages that fail those checks?
Those are SPF, DKIM and DMARC. You do not need to understand them, but you do need all three to exist, and a sending service will give you the exact records to add.
The other reason mail fails
Sending from an address nobody can reply to, or from a domain with no history. Brand new domains are treated cautiously for a while regardless of records. Sending a small amount consistently establishes more trust than a large batch on day one.
The version without the homework
In Ura, an app that needs to send email gets a sending arrangement without you configuring one, and if you attach your own domain the records are shown and ticked off as they take effect.