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 have a private mail server in our organization like mail.domain1.com.

Let's say I have mail id of masud@domain1.com. But when I send mail using the same local part with different domain like this: masud@yahoo.com then the mail bounces. The return mail I got has a mail address of masud@yahoo.com.domain1.com, that's why the MX server cannot find the mail id to send the mail.

Why am I getting this mail id?

Also I don't have a wild card DNS record for that.

Here is the output of resolv.conf:

cat /etc/resolv.conf

search xxxxxxx-ca.com.bd
nameserver 202.84.32.22
nameserver 202.84.32.23

and dig command:

[root@mail ~]# dig yahoo.com

; <<>> DiG 9.3.6-P1-RedHat-9.3.6-16.P1.el5 <<>> yahoo.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63348
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 7, ADDITIONAL: 7

;; QUESTION SECTION:
;yahoo.com.                     IN      A

;; ANSWER SECTION:
yahoo.com.              518     IN      A       206.190.36.45
yahoo.com.              518     IN      A       98.138.253.109
yahoo.com.              518     IN      A       98.139.183.24

;; AUTHORITY SECTION:
yahoo.com.              163160  IN      NS      ns6.yahoo.com.
yahoo.com.              163160  IN      NS      ns2.yahoo.com.
yahoo.com.              163160  IN      NS      ns8.yahoo.com.
yahoo.com.              163160  IN      NS      ns3.yahoo.com.
yahoo.com.              163160  IN      NS      ns4.yahoo.com.
yahoo.com.              163160  IN      NS      ns1.yahoo.com.
yahoo.com.              163160  IN      NS      ns5.yahoo.com.

;; ADDITIONAL SECTION:
ns1.yahoo.com.          163160  IN      A       68.180.131.16
ns2.yahoo.com.          160291  IN      A       68.142.255.16
ns3.yahoo.com.          160291  IN      A       98.138.222.11
ns4.yahoo.com.          160291  IN      A       68.142.196.63
ns5.yahoo.com.          160291  IN      A       119.160.247.124
ns6.yahoo.com.          160423  IN      A       202.43.223.170
ns8.yahoo.com.          160423  IN      A       202.165.104.22

;; Query time: 397 msec
;; SERVER: 202.84.32.23#53(202.84.32.23)
;; WHEN: Sun Apr  7 19:13:01 2013
;; MSG SIZE  rcvd: 313

For security reasons I have disguised my domain name.

sendmail.mc

divert(-1)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
dnl define(`confSMTP_LOGIN_MSG', `$j Sendmail; $b')dnl
dnl define(`confLOG_LEVEL', `9')dnl
dnl define(`SMART_HOST', `smtp.your.provider')dnl
define(`confDEF_USER_ID', ``8:12'')dnl
dnl define(`confAUTO_REBUILD')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST', `True')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `20000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
dnl define(`confAUTH_OPTIONS', `A p')dnl
dnl TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
dnl define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
TRUST_AUTH_MECH('LOGIN PLAIN')dnl
define('confAUTH_MECHANISMS', 'LOGIN PLAIN')dnl
define('confSMTP_LOGIN_MSG', '$j')dnl
dnl define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl
dnl define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')dnl
dnl define(`confSERVER_CERT', `/etc/pki/tls/certs/sendmail.pem')dnl
dnl define(`confSERVER_KEY', `/etc/pki/tls/certs/sendmail.pem')dnl
dnl define(`confDONT_BLAME_SENDMAIL', `groupreadablekeyfile')dnl
dnl define(`confTO_QUEUEWARN', `4h')dnl
dnl define(`confTO_QUEUERETURN', `5d')dnl
dnl define(`confQUEUE_LA', `12')dnl
dnl define(`confREFUSE_LA', `18')dnl
define(`confTO_IDENT', `0')dnl
dnl FEATURE(delay_checks)dnl
FEATURE(`no_default_msa', `dnl')dnl
FEATURE(`smrsh', `/usr/sbin/smrsh')dnl
FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
dnl define(`confMAX_DAEMON_CHILDREN', `20')dnl
dnl define(`confCONNECTION_RATE_THROTTLE', `3')dnl
FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
dnl define(`confLOCAL_MAILER', `cyrusv2')dnl
dnl define(`CYRUSV2_MAILER_ARGS', `FILE /var/lib/imap/socket/lmtp')dnl
dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
dnl DAEMON_OPTIONS(`port=smtp,Addr=::1, Name=MTA-v6, Family=inet6')dnl
dnl DAEMON_OPTIONS(`Name=MTA-v4, Family=inet, Name=MTA-v6, Family=inet6')
FEATURE(`accept_unresolvable_domains')dnl
dnl FEATURE(`relay_based_on_MX')dnl
LOCAL_DOMAIN(`xxxxxxx-ca.com.bd')dnl
MASQUERADE_AS(`xxxxxxx-ca.com.bd')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl
dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl
dnl MASQUERADE_DOMAIN(mydomain.lan)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
dnl MAILER(cyrusv2)dnl
share|improve this question
    
This is a Linux server? What's in your /etc/resolv.conf? And what do you get for dig yahoo.com? –  Ladadadada Apr 7 '13 at 7:52
    
yes this is a RHEL 5.6 server.....in /etc/resolve.conf file i have my dns server ip from ISP like nameserver 202.84.32.xx when i put dig yahoo.com, i get lots of information about NS entry and ips' of yahoo.com –  Masudul Haque Rajib Apr 7 '13 at 9:34
    
Could you put both the contents of your resolv.conf and the entire output of the dig command into your question? –  Ladadadada Apr 7 '13 at 11:06
1  
I should have asked this earlier, (and I did on your last question) but we are almost certainly going to need to see your sendmail config. There are options such as FEATURE(`always_add_domain') and MASQUERADE_AS(`your.hub.domain') that can cause email domains to be rewritten but it will be much easier to look at the config than to guess what might be in it. –  Ladadadada Apr 7 '13 at 17:01
1  
There had been similar question: serverfault.com/questions/496046/… –  Andrzej A. Filip Apr 7 '13 at 20:05

1 Answer 1

First off, if you're going to run a mail server and you've chosen sendmail please go out and buy a copy of the bat book if you haven't already done so. Then spend a weekend reading it - build a virtual network and work through the examples.
This really isn't optional: Sendmail is a complicated beast, and if you want it to play nice you're going to need a good reference.

To your actual problem: as Ladadadada guessed you have a lot of stuff crammed into your sendmail configuration that could cause it to muck with the envelope.
If you are not sure you need them, comment out the masquerade features and other lines and see if your problem goes away. If you are certain you need them, spend some time with the bat book (or at least the Sendmail docs on masquerading to fully understand them and configure them properly.

You have a few other potential problems in your configuration as well (relay_based_on_MX is generally considered "unwise" as it lets anyone use you as a relay server with a simple DNS change on their end. I'm personally not a fan of always_add_domain but that's a personal choice.)

share|improve this answer

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.