Sending email using cURL with a password with special character in bash script

I have an SMTP configuration like the follows: (everything is dummy data)


Note the "!" mark at the end of the password. This cannot be changed.

When I run the below command with everything hardcoded, it works fine, and an email is sent.

curl --url smtp:// --mail-from --mail-rcpt --upload-file tempemailbody_1.txt --user fakenews@yahoo.comg:rdjsllskdslsds! --ssl

However, when I replace them with variables, as below, I keep getting access denied.

curl --url "smtp://$SMTP_SERVER:$SMTP_PORT" --mail-from $EMAIL_FROM --mail-rcpt $EMAIL_TO --upload-file tempemailbody_1.txt  --user "$SMTP_USERNAME:$SMTP_PASSWORD" --ssl

The error message is :

curl: (9) remote access denied: 501

I think that this is because somehow the variable interpretation is causing the issue, but I cant figure out what is it. What should I change in the command to make it work ?