Find out which configuration file sendmail is using.
Make a backup copy of the original configuration file
Go to the directory containing the sendmail configuration files
A look at /etc/mail/localhost.cf will tell you that it is derived from openbsd-localhost.mc
So, let's make a copy of that configuration file ...
... and modify it
To enable masquerading for domain 'mydomain.tld', we could add the following lines to myconfig.mc
Save myconfig.mc after the required changes have been made and convert it to the .cf file
Overwrite the existing configuration
And restart sendmail