Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
This is a very common question. See this answer serverfault.com/questions/344105/… –  adamo Mar 29 '13 at 7:02
add comment

3 Answers

up vote 0 down vote accepted

As you've already discovered yourself, it's because the sending address is invalid.

Most mail servers will check a domain is valid when accepting an email, but usually won't try and verify the actual address. (Some mail servers will pretend an address exists if you ask them, even if it doesn't to stop automated systems building up a list of valid addresses)

However, your own mail server knows that noreply@ is not a valid address and so will reject the email.

The easiest way round this is to set up noreply@ as a valid address and just discard emails sent to it. On UNIX/Linux you can usually just point the address at an entry in aliases that gets delivered to |/dev/null.

share|improve this answer
add comment

Without any further information, I'm guessing your local smtp daemon is misconfigured and is delivering mail to @mydomain.com locally instead of forwarding them upstream. Add your full mailserver config to your post if you want a more detailed answer.

share|improve this answer
    
What information do you need? I'm new to sendmail. –  AaronDS Mar 28 '13 at 15:27
    
Your configuration. And why the hell you're using sendmail instead of something more reasonable, like postfix or exim :) –  Dennis Kaarsemaker Mar 28 '13 at 15:31
    
All I need this for is sending out mail from my app - surely sendmail is perfectly reasonable for that? My config is default but I'll add the sendmail.mc to my post. –  AaronDS Mar 28 '13 at 15:39
    
Added the config to post –  AaronDS Mar 28 '13 at 15:45
add comment

Your smtp service is using your internal dns which dosen't send the @mydomain.com to the web NS which got the MX record on. If you ping your mydomain.com from that webserver it probably show your IIS internal address. I add the same issue and in my case since it was a stand alone server with no other services I put a web static DNS like 8.8.8.8 to test that theory and it worked. (assuming you're on a windows server)

share|improve this answer
    
I'm on Linux, and furthermore the mailserver for all the accounts + the domain itself is on a different server entirely. I'll add this to the main post. –  AaronDS Mar 28 '13 at 16:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.