@Daniel Bäuerlein Thanks for reaching out. You cannot send a mail using mail() function since SMTP connections on TCP port 25 is blocked in Azure and it is suggested to use either SendGrid or Logic apps.
- This guide demonstrates how to perform common programming tasks with the SendGrid email service on Azure. The samples are written in PHP. The scenarios covered include constructing email, sending email, and adding attachments.
- Refer to this documentation steps, if you want to send emails with Gmail from your App Service app by using Azure Logic Apps.
Recommended method of sending email from Azure VM or from Azure App service.
For more information, refer to this blog post on How to send email on App service using Office 365
Feel free to reach back to me if you have further queries on this.