Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

howto forward via alias mail using smart_host

Status
Not open for further replies.

cgtaylor

Technical User
Sep 25, 2009
4
US
Dear Friends,

I been attempting to configure sendmail on a CentOS 5.4 system for some time now.
The objective is to be able to send mail to in-house Exchange 2010 email accounts as well as external addressees. Additionally I want to forward mail for local accounts such as "root" to an Exchange account.

I am using m4 to compile sendmail.mc and submit.mc. I am also using a SMART_HOST definition.

I have met my first two objectives. Unfortunately I can not forward to email aliases using the mail command, but "sendmail -Am root" works properly???
From what I understand, mail sent to the local address must use the MTA (mail transfer agent) to send the mail, and I have not correctly configured for that.
I also read that I can add an"F=A" flag to a mailer definition (but which one) or that a DAEMON_OPTIONS setting will allow for aliasing??

I must admit to being confused by this entire matter, that is why I am hoping someone on this list can advise me.

Best Regards,
Clem Taylor

Useful?? information follows...

[root@lxmv48 mail]# grep ^M sendmail.cf
Msmtp, P=[IPC], F=mDFMuX, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, E=\r\n, L=990,
Mesmtp, P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, E=\r\n, L=990,
Msmtp8, P=[IPC], F=mDFMuX8, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, E=\r\n, L=990,
Mdsmtp, P=[IPC], F=mDFMuXa%, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP, E=\r\n, L=990,
Mrelay, P=[IPC], F=mDFMuXa8, S=EnvFromSMTP/HdrFromSMTP, R=MasqSMTP/MasqRelay, E=\r\n, L=2040,
Mprocmail, P=/usr/bin/procmail, F=DFMSPhnu9, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP/HdrFromSMTP,
Mlocal, P=/usr/bin/procmail, F=lsDFMAw5:/|@qSPfhn9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL,
Mprog, P=/usr/sbin/smrsh, F=lsDFMoqeu9, S=EnvFromL/HdrFromL, R=EnvToL/HdrToL, D=$z:/,


[root@lxmv48 mail]# grep -v ^dnl sendmail.mc
divert(-1)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
define(`SMART_HOST', `hubmv01.corp.xyzcorpint.com')dnl
define(`confDEF_USER_ID', ``8:12'')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/mail/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confTO_IDENT', `0')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
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
DAEMON_OPTIONS(`Port=smtp,Name=MTA')dnl
DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
FEATURE(`accept_unresolvable_domains')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl
MASQUERADE_AS(`xyzcorp.com')dnl
FEATURE(masquerade_envelope)dnl
FEATURE(allmasquerade)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(xyzcorp.com)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl


[root@lxmv48 mail]# grep -v ^dnl submit.mc
divert(-1)
divert(0)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`linux setup')dnl
define(`confCF_VERSION', `Submit')dnl
define(`__OSTYPE__',`')dnl dirty hack to keep proto.m4 from complaining
define(`_USE_DECNET_SYNTAX_', `1')dnl support DECnet
define(`confTIME_ZONE', `USE_TZ')dnl
define(`confDONT_INIT_GROUPS', `True')dnl
define(`confPID_FILE', `/var/run/sm-client.pid')dnl
FEATURE(`use_ct_file')dnl
define(`confDOMAIN_NAME', `xyzcorp.com')dnl
FEATURE(`msp', `hubmv01.corp.xyzcorpint.com')dnl


This works ....
[root@lxmv48 mail]# ( echo subject: test test test test; echo) | sendmail -Am -v root root... aliased to clement.taylor@xyzcorp.com clement.taylor@xyzcorp.com... Connecting to hubmv01.corp.xyzcorpint.com.
via relay...
220 HUBMV01.corp.xyzcorpint.com Microsoft ESMTP MAIL Service ready at Tue, 5 Jan 2010 18:04:03 -0500
>>> EHLO lxmv48.corp.xyzcorpint.com
250-HUBMV01.corp.xyzcorpint.com Hello [172.24.5.148] 250-SIZE 10485760 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-STARTTLS 250-AUTH 250-8BITMIME 250-BINARYMIME 250 CHUNKING
>>> STARTTLS
220 2.0.0 SMTP server ready
>>> EHLO lxmv48.corp.xyzcorpint.com
250-HUBMV01.corp.xyzcorpint.com Hello [172.24.5.148] 250-SIZE 10485760 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-AUTH 250-8BITMIME 250-BINARYMIME 250 CHUNKING
>>> MAIL From:<root@xyzcorp.com> SIZE=30
250 2.1.0 Sender OK
>>> RCPT To:<clement.taylor@xyzcorp.com>
>>> DATA
250 2.1.5 Recipient OK
354 Start mail input; end with <CRLF>.<CRLF>
>>> .
250 2.6.0 <201001052304.o05N44jd007077@lxmv48.corp.xyzcorpint.com>
[InternalId=2045] Queued mail for delivery clement.taylor@xyzcorp.com... Sent (<201001052304.o05N44jd007077@lxmv48.corp.xyzcorpint.com>
[InternalId=2045] Queued mail for delivery) Closing connection to hubmv01.corp.xyzcorpint.com.
>>> QUIT
221 2.0.0 Service closing transmission channel

This goes nowhere !!!!
[root@lxmv48 mail]# mail root
Subject: hello
hello
.
Cc:
[root@lxmv48 mail]#
 
Why don't you just define the aliases in the /etc/mail/aliases file? For example, to get root email sent somewhere else as well, you can make an entry...

root: root, somebody@domain.com

If you change aliases, then issue "newaliases" to load the aliases.db with the new info.
 
Thank you "psi07004" for your thoughts.
This is the whole reason for this post, I do have a compiled aliases table and aliases are successfully resolved but the mail messages are not forwarded because the correct MTA is not called by the mail program. As noted in the posting if I do the following the message goes through.

( echo subject: test test test test; echo) | sendmail -Am -v root
root... aliased to clement.taylor@xyzcorp.com clement.taylor@xyzcorp.com... Connecting to hubmv01.corp.xyzcorpint.com.
via relay...
220 HUBMV01.corp.xyzcorpint.com Microsoft ESMTP MAIL Service ready at Tue, 5 Jan 2010 18:04:03 -0500
>>> EHLO lxmv48.corp.xyzcorpint.com
250-HUBMV01.corp.xyzcorpint.com Hello [172.24.5.148]
>>> STARTTLS
220 2.0.0 SMTP server ready
>>> EHLO lxmv48.corp.xyzcorpint.com
250-HUBMV01.corp.xyzcorpint.com Hello [172.24.5.148] 250-SIZE 10485760 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-AUTH 250-8BITMIME 250-BINARYMIME 250 CHUNKING
>>> MAIL From:<root@xyzcorp.com> SIZE=30
250 2.1.0 Sender OK
>>> RCPT To:<clement.taylor@xyzcorp.com>
>>> DATA
250 2.1.5 Recipient OK
354 Start mail input; end with <CRLF>.<CRLF>
>>> .
250 2.6.0 <201001052304.o05N44jd007077@lxmv48.corp.xyzcorpint.com>
[InternalId=2045] Queued mail for delivery clement.taylor@xyzcorp.com... Sent (<201001052304.o05N44jd007077@lxmv48.corp.xyzcorpint.com>
[InternalId=2045] Queued mail for delivery) Closing connection to hubmv01.corp.xyzcorpint.com.

I can send mail messages via the client, but forwarded messages require a mail server (smtp, esmtp ??) and I am not correctly pointing to the mailer.

I have not found any help on this from any Google search, very humbling.

Regards, Clem
 
I found this post on linuxquestions that clearly states my problem in sending mail to an alias.

"Reading about sendmail shows that from ~8.12 the program is split in a MTA part and a MSP(message submission program) part. The authentication for the MTA clearly works as tested with "sendmail -Am" which uses sendmail.cf. However sending local mail on the PC itself first submits the mail to the MSP of Sendmail, which is then routed to the MTA. Something in this routing clearly goes wrong in my case. Testing with "sendmail -Ac", which uses submit.m) confirms that the email is sent to the external smtp-server, but it never arrives at the email-address used."

"Unfortunately no howto's seem to deal with this problem and I'm stuck at the moment after messing for days with sendmail. The closest thing that seems related to this problem seems to be this page in the sendmail-doc's:www.sendmail.org/m4/msp.html
 
 http://www.sendmail.org/m4/msp.html
Try the following and see if it makes any difference.

Make sure you have an entry in sendmail.cf for:
Cwlocalhost

Also make sure the sendmail.cw file has the entry localhost on a line by itself.

After making these changes be sure to refresh sendmail so it reads them.
 
The Cw command is included in the compiled sendmail.cf file.

[CORP+ctaylor2@lxmv48 mail]$ sudo grep Cw sendmail.cf
Cwlocalhost

Again my issue is that this works ....
[CORP+ctaylor2@lxmv48 mail]$ sudo /usr/sbin/sendmail -Am root
Hello Clem
.

From /var/log/maillog ...
Jan 12 17:39:59 lxmv48 sendmail[16747]: o0CMdjZI016747: from=CORP+ctaylor2, size=11, class=0, nrcpts=1, msgid=<201001122239.o0CMdjZI016747@lxmv48.corp.xyzcorp.com>, relay=root@localhost
Jan 12 17:39:59 lxmv48 sendmail[16751]: STARTTLS=client, relay=hubmv01.corp.xyzcorp.com., version=TLSv1/SSLv3, verify=FAIL, cipher=AES128-SHA, bits=128/128
Jan 12 17:39:59 lxmv48 sendmail[16751]: o0CMdjZI016747: to=clement.taylor@xyzcorp.com, ctladdr=CORP+ctaylor2 (10000/10000), delay=00:00:14, xdelay=00:00:00, mailer=esmtp, pri=120011, relay=hubmv01.corp.xyzcorp.com. [172.26.20.114], dsn=2.0.0, stat=Sent (<201001122239.o0CMdjZI016747@lxmv48.corp.xyzcorp.com> [InternalId=149258] Queued mail for delivery)

Here is the message that gets transmitted to Exchange ..

X-MimeOLE: Produced By Microsoft Exchange V6.5
Received: from WSMV57.corp.xyzcorpint.com ([172.26.20.57]) by EVSMV01.corp.xyzcorpint.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 12 Jan 2010 17:40:00 -0500
MIME-Version: 1.0
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Received: from WSMV114.corp.xyzcorpint.com ([172.26.20.114]) by WSMV57.corp.xyzcorpint.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 12 Jan 2010 17:39:59 -0500
Received: from lxmv48.corp.xyzcorpint.com (172.24.5.148) by HUBMV01.corp.xyzcorpint.com (172.26.20.114) with Microsoft SMTP Server (TLS) id 14.0.639.21; Tue, 12 Jan 2010 17:39:58 -0500
Received: (from root@localhost) by lxmv48.corp.xyzcorpint.com (8.13.8/8.13.8) id o0CMdjZI016747 for root; Tue, 12 Jan 2010 17:39:45 -0500
Return-Path: <CORP+ctaylor2@xyzcorp.com>
X-OriginalArrivalTime: 12 Jan 2010 22:39:59.0285 (UTC) FILETIME=[2BF00650:01CA93D8]
Content-class: urn:content-classes:message
Subject:
Date: Tue, 12 Jan 2010 17:39:45 -0500
Message-ID: <201001122239.o0CMdjZI016747@lxmv48.corp.xyzcorpint.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
Thread-Index: AcqT2CyRffoEQb4EQ1GOOSH7WMNWpg==
From: CORP+ctaylor2@xyzcorp.com
To: Undisclosed recipients <Undisclosed recipients:;>
X-Evolution-Source: exchange://ctaylor2;auth=Basic@owa.xyzcorp.com/


Hello Clem

This is a difficult problem for me to solve!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top