Outgoing email with PHP mail() is heavily restricted on InfinityFree. Fortunately, you can still whatever email you want using an external email service.
There are many external email providers to choose from. InfinityFree doesn’t restrict sending email with external providers. Almost all of them have paid plans, but some have free tiers too. Most of them support sending email over SMTP, some of them have custom APIs, libraries and plugins which you can use too.
A simple way to get started quickly and for free is to send email with a free Gmail account.
If you use existing website management software, this software may have support for SMTP built-in. If not, there is usually a plugin you can use to send email with SMTP, or even connect it directly with your desired e-mail provider.
If you’re using WordPress, you can use the WP Mail SMTP by WPForms plugin. This plugin allows you to send email with any SMTP server, and even natively support Gmail as a preferred provider.
If you’re building your own website, you’ll need to code something yourself. SMTP libraries like PHPmailer or SwiftMailer make this easy. To help you get started, we have provided an example contact form with PHPmailer which you can use for your own website: https://github.com/InfinityFreeHosting/contactform