You need to configure sendmail masquerading. If I understand correctly, you want mail from your host db1.mydomain.com to appear to come from mydomain.com
This is easier if you use the m4 macro processor - editing the sendmail.cf quickly gets hairy in my experience, instead edit the sendmail.mc template and rebuild it with something like
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Basically, if you start editing the sendmail.cf directly you're on your own.
(you also didn't specify what OS you're on so you may have to install the m4 processor and sendmail-cf packages or similar for whatever you're using)
Add these lines to your sendmail.mc:
MASQUERADE_AS(`mydomain.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
You only need masquerade_entire_domain if you want to rewrite envelopes from say, a machine host.myotherdomain.com. You probably won't need that, so you can comment it out in the sendmail.mc file by prepending "dnl" to it. (note that the envelope rewrite controls what sendmail uses in SMTP/ESMTP conversations with oher servers, while the MASQUERADE_AS line rewrites the "From:" line that the recipient actually sees)
'dnl', perversely, works in m4 like "#" does in shell scripts. "Delete through newline" IIRC. You can't make this stuff up. It's really disgusting.
If you want sendmail to masquerade mail from root as well (it will normally expose the FQDN for mail from root) you need to change
EXPOSED_USER(`root')dnl
to
dnlEXPOSED_USER(`root')dnl
Ok, now you need to make sure your sending clients are authorized to relay through db1.mydomain.com. Right now for whatever reason your machine is sending with an envelope name of localhost.mydomain.com (I would imagine it's connecting to its loopback address or something, but can't be sure, maybe you've got something screwed up in your DNS) which is not permitted to relay. The simplest and safest way around this is to make a list of all envelope names your authorized machines will present in /etc/mail/relay-domains (in your case, adding localhost.mydomain.com to your relay-domains file, along with any other hosts (FQDNs, again, with proper A and PTR records), and add
FEATURE(relay_hosts_only)dnl
to your sendmail.mc.
Alternately you can use
FEATURE(relay_entire_domain)dnl
Which will permit any host in mydomain.com to relay mail through db1.mydomain.com. Personally I prefer the more restrictive option.
There are many (MANY) other FEATURE macros
You should probably have a look at the docs to get an idea. (sendmail.com) - (although in the time that takes you might be able replace sendmail with postfix...)
Once you're done editing your sendmail.mc generate the sendmail.cf as I described above.
m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
And restart sendmail.
I hope this helps. Google around for "sendmail masquerading" and "controlling sendmail relaying" for lots more info. And don't edit your cf directly, it's a world of pain.
-qb