Beware that this error might also occur when the from email does not match the username.
So, be sure to test the value myemail@example.com is the same on user and from.
If it works when both fields have the same value and doesn't work when the from is different from the user, it means you should contact the company responsible for the email server and ask them to create a shared account and add SendAs priviledges for the account.