1847167 Members
6067 Online
110263 Solutions
New Discussion

sendmail macro

 
SOLVED
Go to solution
John Carver
Frequent Advisor

sendmail macro

I need to relay mail from an HPUX server through a smtp server using sendmail. I have been told to create a new sendmail.cf using
m4. I have located the directories for m4 but
not sure what to do with it. I have browsed the O'Reilly book "Sendmail", but at this point
I need the "Cliff Note" version to get going on
this.
4 REPLIES 4
Jeff Schussele
Honored Contributor
Solution

Re: sendmail macro

Hi John,

If you just want all mail coming out of this host to relay thru that SMTP server, then all you need do is define a SmartHost with the DS macro
Simply add

DSsmtphost.company.com

to the /etc/mail/sendmail.cf file & bounce sendmail
/sbin/init.d/sendmail stop
/sbin/init.d/sendmail start

And that should cover it.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
A. Clay Stephenson
Acclaimed Contributor

Re: sendmail macro

This is trivially easy and we don't need no stinkin' m4. All you need to do is edit /etc/mail/sendmail.cf (after making a copy in case you do something dumb) and add a "Smart" relay. You will actually fnd some comments in the file but here's what you do:

DSemail.acme.com

That will send all non-local email to email.acme.com for further handling.

You then cd to /sbin/init.d and
./sendmail stop
./sendmail start

and you should be done assuming you can resolve the hostname of your smart reley.
If it ain't broke, I can fix that.
W.C. Epperson
Trusted Contributor

Re: sendmail macro

One undertakes to contradict Clay with some trepidation, but if M4 configuration is the standard for his shop, he _may_ need the steenking thing. Else another admin following standards may blow away his DS setting by regenerating the .cf file from the .mc file.

So, to get your DS setting via M4, put SMART_HOST in your .mc file:

define(`SMART_HOST', `host.domain.')

A brief intro and sample of a .mc file is at:
http://www.sendmail.org/m4/intro.html

The main config page is:
http://www.sendmail.org/m4/readme.html
"I have great faith in fools; self-confidence, my friends call it." --Poe
Steven E. Protter
Exalted Contributor

Re: sendmail macro

Here is a are two possible ways to generate a sendmail.cf file from the sendmail.mc

1) run gen_cf. I think its a HP add on to sendmail, but it seems to work on my sandbox.
2) The script I'm attaching, which will probably require tweaking.


SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com