cancel
Showing results for 
Search instead for 
Did you mean: 

sendmail.cf

SOLVED
Go to solution

sendmail.cf

We have the following setting in our .cf file

Dj$w.

The problem is that if an e-mail is going external my Network adminstrator is telling me that e-mails are being stopped because the domainname is not valid.

The e-mails show they are coming from
'user id@hostname.domainname' and I get the following in the mail.log
Jan 13 09:19:57 hpfiscal sendmail[22044]: unable to qualify my own domain name (hpfiscal) -- using short name
Jan 13 09:19:57 hpfiscal sendmail[22044]: be sure to set domain name in Dj macro in sendmail.cf


I would like it just to say
'user id@domainname'
I have tried removing the $w but had no joy.

Can someone suggest how to remove the hostname from the 'from' address.

Thanks
George
15 REPLIES
Jeeshan
Honored Contributor

Re: sendmail.cf

did you change your /etc/hosts and resolv.conf files accordingly?
a warrior never quits

Re: sendmail.cf

Ahsan,

The nsswitch is set to files and then dns.

I am not an expert on address resolution so do not know what should be in the /etc/hosts pertaining to sendmail.

Sendmail seems to know the host and knows the domain but I just do not want it to dispaly both after the @ sign in the 'from' address.

Thank you for the interest.
George
Jeeshan
Honored Contributor

Re: sendmail.cf

Ahsan,

Those links are related and indeed one of them stopped the error messages on the mail.log

However my initial problem remains. When the e-mail is sent out the 'from' address still says 'userid@hostname.domainname' and I would like it to say 'userid@domainname' only.

Hope that makes sense.
Thanks
George
Avinash20
Honored Contributor

Re: sendmail.cf

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1039532
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Avinash20
Honored Contributor

Re: sendmail.cf

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=87762
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Elmar P. Kolkman
Honored Contributor

Re: sendmail.cf

I've done this in our sendmail.cf:

#
# envelope sender rewriting
#
S11
R$- $@ $1@
R$- $+ $1
R$- $@ $1@

R$+ $: $>51 $1 sender/recipient common
R$* :; <@> $@ list:; special case
R$* $: $>61 $1 qualify unqual'ed names
R$+ $: $>94 $1 do masquerading

I'm not sure anymore which lines I've added and which were already there, but this made it work exactly the way you want it too. (of course replace by your domain)
Every problem has at least one solution. Only some solutions are harder to find.
Pratyush Paul_1
Valued Contributor

Re: sendmail.cf

Hi - here is the fix for the sendmail issue you are having..


Dj - macro in sendmail.cf is for domainname,

Djnodename.somedomain.com

make sure you have the same entry in the /etc/hosts file also

then do this test and see if the email can be delivered

#/usr/sbin/sendmail -v userid@mailserver.com

test mail

. (terminate with a dot)

let me know if this is working.

regards

Pratyush
Die Hard

Re: sendmail.cf

Thank you all for your replies.

Still not having much joy of removing the nodename from the 'from' address.

Avinash, I followed your link and attempted the User Database route but it hasn't made a difference. I must be missing some step along the way.

Elmar, I must admit I didn't fancy changing my sendmail.cf with all that input you suggested especially as I had no understanding of what it is doing.

Pratyush, What you suggested is exactly what my current setup is. Djnodename.domainname and that's why I thought it was putting both in my 'from' address.

Just to clarify, When sending mail via sendmail I need to have
username@nodename.domainname to be dispalyed
username@domainname.

I didn't realise it would be such a difficult thing to do but I do appreciate all the effort.
George
F Verschuren
Esteemed Contributor

Re: sendmail.cf

username@nodename.domainname to be dispalyed
username@domainname.

can be doe by creating a alias:
this can be done by:
echo "username : username@domainname. " >> /etc/aliases
and than run
newaliases -v

thats all...
F Verschuren
Esteemed Contributor

Re: sendmail.cf

ps If you need all the users to be added you can use the following "script"

cat /etc/passwd |awk -F: '{print $1 }' |while read line
do
echo $line " : " $line ".domainame" >> /etc/aliases
done

Kind regards Freek

Re: sendmail.cf

F,

Thanks for the attempt.

Can you expalin a bit more how the aliase works with sendmail.
I added the local entry

# Local aliases
goreilly : goreilly@domainname.co.uk

I don't understand how that would solve my problem (which it didn't) so hard to troubleshoot.

I am still getting username@hostname.domainname in the from address.

Because I am getting no joy in no matter what I try I wonder is something somewhere overriding any changes I make, in
sendmail.cf for example?

Cheers
George
Avinash20
Honored Contributor
Solution

Re: sendmail.cf

If it's just the domain which needs to be rewritten, then that's hostname masquerading. The simplest way to do this is with the DM setting in sendmail.cf - but check class E (CE setting) as by default the root user is excluded from masquerading.
"Light travels faster than sound. That's why some people appear bright until you hear them speak."

Re: sendmail.cf

Avinash,

Thanks a million, you're a star.

Ths DM in sendmail.cf worked a treat. It was simple after all.

All Sorted.

George

Re: sendmail.cf

Sorry just closing the thread.

Thank you to everyone.
George