How to properly configure sendmail to delivery message? [closed]

I bought a VPS from OVH.

This Ubuntu VPS hostname is something like vps12345 or vps12345.ovh.net.

If I test sendmail via command line to send an email to my mail [email protected], it works: I receive an email from test@[email protected].

But I'd like to send mail from my installed domain (for instance: [email protected]), and if test from my PHP code, mail sent to Gmail arrives but with a lot time late.

So I suppose that Gmail (or anyother email provider) don't accept emails with header from X domain, but from an hostname Y...

So how can I send email from my vps12345 using other domain (which I own and host on that VPS)?

Do I need to rename VPS hostname?

Thanks


Proper way: change host FQDN (fully quallified domain name) as reported by hostname command (typically hostname --fqdn). The exact procedure may by OS/Distribution dependand.

Sendmail only fix: "who am I" in cf/README file in sendmail distribution.
=>define confDOMAIN_NAME in sendmail.mc file and generate new sendmail.cf (submit.cf may also require changes).