Thank you for your help.
Unfortunately, your solution don’t work because this error occured:
Server response
554 5.2.3 MailPolicy violation Error delivering to mailboxes
I think you are using an email alias to send from mydomain.com from your gmail address right? I am not sure the Gmail app will allow you to send the alias email address. I assume you don’t have a paid Google Workspace account which would allow you to do this?
You may wish to set up an email sending software like mailgun to accomplish this. It will require you to setup some DNS settings to allow you to send on behalf of mydomain.com but you will get around the limitations that Gmail sets on outbound emails from @gmail.com addresses.