Zend certified PHP/Magento developer

Why I don’t receive email from customer form? (Magento 2.4)

I’ve created a CMS page with a form where customers can submit some info & by clicking ‘submit’ Magento sends an email (with all the info provided into the form) to an address that I set by a custom configuration tab (Stores > Configuration > Vendor > Module).

I developed it via TransportBuilder: I set up all those files such as email_templates.xml, I created the email template and I’ve already extended the Magento TransportBuilder class in order to attach a ZIP file to the email (I created the addAttachment() method).

Here’s the function in my controller (the $templateVars param is an array that I pass correctly, already checked):

But what is the problem?

When I test this from localhost (working on a local MAMP server), I submit the form and suddenly I correctly receive the email with the right attachments etc. Perfect.

But when I test this on a live server the mail isn’t delivered! Even logging with the module’s own logger and checking the Magento Sent Emails’ Log, they both say that the email was successfully sent but it doesn’t arrive into my inbox! I tried to find a solution for days and days but I didn’t manage to. Someone’s got a solution?