1

A cloud-based server set-up by a 3rd party is using sendmail to do email sending.

Now, the sendmail has been configured so that emails from www-data@localhost [1] is sent as www-data@example.com. The emails mostly are sent to the 3rd party email, for example someone@example2.net (notice different target domain).

However, now we need to also send email to admins@example.com. Attempting to do that, however, results in 550 5.1.1 <admins@example.com>... User unknown.

I'm severely in the blank for configuring sendmail.

Can anyone provide some pointers on how to do this properly?

[1] That is the ServerAdmin name as defined in /etc/apache2/sites-available/default


@MadHatter asked:

"the sendmail has been configured so that emails from www-data@localhost is sent as www-data@example.com". How, exactly?

I think through the following lines in /etc/mail/sendmail.mc:

dnl # Replace sender's domain
MASQUERADE_AS(`example.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(`example.com')dnl

(Again, I'm not the one making the sendmail.mc file; if there's a certain line to look for, I'd be happy to post it here).


Here are additional info:

root@webserver:/etc/mail# grep '^Fw' sendmail.cf
Fw/etc/mail/local-host-names %[^\#]
root@webserver:/etc/mail# cat local-host-names
localhost
webserver
  • You say that "the sendmail has been configured so that emails from www-data@localhost is sent as www-data@example.com". How, exactly? – MadHatter Oct 17 '14 at 6:50
  • 1
    That should be fine, thanks. It doesn't explain why mail for example.com is being delivered locally. Could you edit into your question that result of grep '^Fw' /etc/mail/sendmail.cf, and the contents of the file that then appears? – MadHatter Oct 17 '14 at 7:34
  • Thank you, that's great. Also strange; why does this mail server think that it's authoritative for example.com? Could you add the results of hostname and echo ""|sendmail -bt -d0,11? – MadHatter Oct 17 '14 at 7:45
0

Is example.com listed on list of local email domains? To get list of local email domains execute as root the command below:

echo '$=w' | sendmail -Am -bt

Sendmail by default adds autodetected local email domains to domains listed in /etc/mail/local-host-names . It can be turned off using confDONT_PROBE_INTERFACES in sendmail.mc

define(`confDONT_PROBE_INTERFACES',`True')

sendmail.mc must be recompiled into sendmail.cf, sendmail daemon must be restarted or HUPed to see new sendmail.cf.

0

thanks for attempting to answer my question!

Over the weekend, the guy originally setting up the server finally modified sendmail.mc with the following (I just received his email this morning):

  • Delete the following line:
define(`confDOMAIN_NAME', `example.com')dnl
  • Add one line after the previously posted 4 lines:
MASQUERADE_AS(`example.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(`example.com')dnl
define(`MAIL_HUB', `mailgw.example.com.')dnl

Now emails to @example.com gets properly routed to the actual mailserver serving @example.com.

Thanks for the assistance, guys!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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