LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to set DJ and DS in sendmail.mc rather than sendmail.cf manually (https://www.linuxquestions.org/questions/linux-software-2/how-to-set-dj-and-ds-in-sendmail-mc-rather-than-sendmail-cf-manually-4175516342/)

anon091 08-25-2014 04:50 PM

How to set DJ and DS in sendmail.mc rather than sendmail.cf manually
 
The only way I know how to configure these two settings for sendmail is to directly edit the sendmail.cf, so I wanted to finally learn how to do it the proper way by editing the .mc then making the cf. My only problem is, i'm not finding a document or chart to match up what i have to change in the mc to get the desired result in the cf.


# my official domain name
# ... define this only if sendmail cannot automatically determine your domain
#Dj$w.Foo.COM
Dj MyDomainGoesHere.com

# "Smart" relay host (may be null)
DSrelay.goes.here

TB0ne 08-26-2014 09:02 AM

Quote:

Originally Posted by rjo98 (Post 5227138)
The only way I know how to configure these two settings for sendmail is to directly edit the sendmail.cf, so I wanted to finally learn how to do it the proper way by editing the .mc then making the cf. My only problem is, i'm not finding a document or chart to match up what i have to change in the mc to get the desired result in the cf.

# my official domain name
# ... define this only if sendmail cannot automatically determine your domain
#Dj$w.Foo.COM
Dj MyDomainGoesHere.com

# "Smart" relay host (may be null)
DSrelay.goes.here

For smart host (DS):
Code:

define(`SMART_HOST',`some.host.name')
For domain (DJ):
Code:

DOMAIN('yourdomain.com')dnl
http://www.sendmail.com/sm/open_sour.../m4/README.txt

anon091 09-02-2014 08:28 AM

I got my smart host in there ok, but not having luck with the DOMAIN part. I changed yourdomain.com to what I wanted, and got the following error

m4:sendmail.mc:26: cannot open `/usr/share/sendmail-cf/domain/Domain.I.Tried.To.Set.It.As.com.m4': No such file or directory

Basically what I'm trying to do is when this server sends an email, rather than it saying it's coming from whoever@localhost.localdomain, I want it to say whoever@SomethingThatMakesSense.something, where I'd be happy with whoever@servername.com or something like that just so we can tell what server it came from.

TB0ne 09-02-2014 10:26 AM

Quote:

Originally Posted by rjo98 (Post 5231175)
I got my smart host in there ok, but not having luck with the DOMAIN part. I changed yourdomain.com to what I wanted, and got the following error

m4:sendmail.mc:26: cannot open `/usr/share/sendmail-cf/domain/Domain.I.Tried.To.Set.It.As.com.m4': No such file or directory

Basically what I'm trying to do is when this server sends an email, rather than it saying it's coming from whoever@localhost.localdomain, I want it to say whoever@SomethingThatMakesSense.something, where I'd be happy with whoever@servername.com or something like that just so we can tell what server it came from.

Right...and from the sendmail documentation link provided in the first response:
Quote:

Originally Posted by Sendmail Documentation about Domains
# To create your own configuration file,
# create an appropriate domain file in ../domain, change the
# `DOMAIN' macro below to reference that file, and copy the result
# to a name of your own choosing.

...and....
*******************************************************************
*** BE SURE YOU CUSTOMIZE THESE FILES! They have some ***
*** Berkeley-specific assumptions built in, such as the name ***
*** of their UUCP-relay. You'll want to create your own ***
*** domain description, and use that in place of ***
*** domain/Berkeley.EDU.m4. ***
*******************************************************************

So, the domain file doesn't exist, because you haven't created it yet, following the instructions and sample files provided with Sendmail.

anon091 09-02-2014 10:59 AM

Sorry, guess I didn't write my question right/out fully. I see the sample domain files, but do I just vi them, or is there some make type utility I need to use for here too?

Also, can I just take the generic.m4, rename it and add
DOMAIN(mydomain.whatever)dnl
and that should work? I think it would but obviously I'm not sure on this.

TB0ne 09-02-2014 11:59 AM

Quote:

Originally Posted by rjo98 (Post 5231252)
Sorry, guess I didn't write my question right/out fully. I see the sample domain files, but do I just vi them, or is there some make type utility I need to use for here too?

Nope, just edit them, and when you do the m4 build on your main file, it'll churn through things, if I remember correctly.
Quote:

Also, can I just take the generic.m4, rename it and add DOMAIN(mydomain.whatever)dnl and that should work? I think it would but obviously I'm not sure on this.
Yes, that should be all you need.

anon091 09-02-2014 01:58 PM

OK, think I did that ok, make no longer complains. Send a test email, but the domain part still came through as localhost.localdomain. So I look in my sendmail.cf and I don't have the DJ. In my .mc I have
DOMAIN(`NameIWant')dnl
where NameIWant matches the name of the .m4 I just did.

Is there maybe another way to set domain via the mc?

anon091 09-02-2014 02:09 PM

actually, think I may have gotten it, although i'm not sure why. I added a
define(`confDOMAIN_NAME', `MyServer.com')dnl
and now the domain part comes through as MyServer.com


All times are GMT -5. The time now is 12:23 PM.