I'm using sendmail on my webserver, which so far is working fine. However, when I send emails to the same domain I'm sending them from, they never get delivered. I temporarily changed the email information in my application to another domain, at which point it send to my domain mail accounts no problem.
// does not work
$from = 'noreply@mydomain.com'
$to = 'admin@mydomain.com'
// works fine
$from = 'noreply@someotherdomain.com'
$to = 'admin@mydomain.com'
Furthermore, the server this is run on is a separate server to the one that has the mail accounts & domain set up. (+ I'm on linux)
sendmail is using the default configuration.
I've tried testing with the following command, however I seem to get a bunch of unverified sender errors. When I do this with my gmail account, it goes through OK.
echo -e "To: test@mydomain.com\nSubject: Test\nTest\n" | sendmail -bm -t -v
Edit
It turns out that it just requires the email address its coming from to exist. Is there any way to bypass this?