Sometimes it becomes necessary to masquerade the domain name of the sender .At my work place there was a rule set in the exchange server which blocks mails to my mail ids which are coming from domains other than desireddomain.com .Even if I want to test the sendmail functionality in our solaris servers I can't verify it by sending to my mail id.Here masquerading helped me.Please see the configuration i used.
Let the domain name be 123.com in /etc/hosts file.
1.Edit sendmail.mc
file
Enter masquerading feature just before the
MAILER section.
# vi
/etc/mail/sendmail.mc
define(`confFALLBACK_SMARTHOST',
`mailhost$?m.$m$.')dnl
FEATURE(masquerade_entire_domain)
FEATURE(masquerade_envelope)
MASQUERADE_AS(`desireddomain.com')
MASQUERADE_DOMAIN(`123.com')
MAILER(`local')dnl
MAILER(`smtp')dnl
2.Create the
sendmail.cf file
# cd /etc/mail
# /usr/ccs/bin/make
sendmail.cf
3.Reread the configuration
file.
Send the Sendmail
process a SIGHUP to begin using the new configuration file.
kill -HUP `head -1
/var/run/sendmail.pid`
or
Restart the sendmail
service
# svcadm restart
sendmail
4.Testing the
configuration
Login as a user other
than root(root user is an Exposed user pls don't masquerade him)
Let the user be suresh and domain be 123.com.The sender will be displayed as suresh@desireddomain.com to user@xyz.com,the recipient of the mail.
$ mailx -v -s "test"
user@xyz.com
hi
.
Observe the output we can see suresh@desireddomain.com as sender address instead of suresh@123.com.
As sendmail is not depending on any particular OS it should be applicable in other Operating systems also.
As sendmail is not depending on any particular OS it should be applicable in other Operating systems also.
Here the exchange server rule got bypassed...
Great You have done
!!!
No comments:
Post a Comment