1823082 Members
3499 Online
109646 Solutions
New Discussion юеВ

Re: send mail

 
Sunil Sharma_1
Honored Contributor

send mail

Hi All,

I need to send a mail to external domain from my unix server.mail admin says it should contain some specific domain name i.e @abc.com and my server is in xyz.com doamin.
How can I do this ?

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
11 REPLIES 11
Rick Garland
Honored Contributor

Re: send mail

'mailx you@abc.com'

If the sendmail.cf file had been configured to send out mail, one of the default settings is to attach the "From" address label.

Do you want to change the "From" address label in your mail?



Geoff Wild
Honored Contributor

Re: send mail

Either setup up a smart relay server in sendmail.cf:

# "Smart" relay host (may be null)
DSyourmailserver

Or - you mean your server's domain name? well - setup masquerade:

# who I masquerade as (null for no masquerading) (see also $=M)
abc.com


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: send mail

Oops - should be:

DMabc.com

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Sunil Sharma_1
Honored Contributor

Re: send mail

Thanks for reply.


Rick: Yes I want to change From address in my mails.

Geoff:

Could you explain your solution ? I am no goot in mail issues ...

Sunil

*** Dream as if you'll live forever. Live as if you'll die today ***
Geoff Wild
Honored Contributor

Re: send mail

Well - it's quite easy - the DM macro changes your from domain to whatever you want.

Example - we use an internal domain where I work - say mycorp.net

So, all my servers are: server1.mycorp.net

But, on the internet, we are mycompany.com

So, I set the DM macro to:

DMmycompany.com

When I send an email from the unix server to say, HP support - instead of being sent from: gwild@myserver.mycorp.net - it goes as gwild@mycompany.com

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Rick Garland
Honored Contributor

Re: send mail

The DM, or "masquerade as" directive is what you change.
Sunil Sharma_1
Honored Contributor

Re: send mail

Geoff,

I want this unix server for mail sending only. This will send to mail server(Exchange/Domino) and then go to domain.


Is yor solution still valid for this ?

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
Bejoy C Alias
Respected Contributor

Re: send mail

To send the outgoing mail to the relay server , in ur case it is a exchange/domain server , u have to put the relay server name in the DS macro of ur sendmail.cf file like.
DSmy.exchange.com
The server from which u r sending the mail should be able to resolve this exchange server name, and the exchange server should be configured to allow relaying from the unix server . And the DM should be set to DMabc.com to masquerade ur outgoing mail's domain as abc.com.
Be Always Joy ......
Geoff Wild
Honored Contributor

Re: send mail

Sunil - yes - that's how we do it where I work.

All our Unix servers send to the smart relay (Exchange Server), and masquerade as the "external" domain.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
D Block 2
Respected Contributor

Re: send mail

Sunil- when you change the sendmail.cf, also follow the change with a Stop/Start:

$ /sbin/init.d/sendmail stop
$ /sbin/init.d/sendmail start

You can also, run the -bt option to look at some important macro variables, for example:

After you change the $M variable, you can check on the actual value by running a test command and then enter input commands:

$j <- I think you want this one to
say: myhostname.xyz.com
$w <- I think you want this one to say: myhostname
$m <- I think you want this one to say: xyz.com




$ sendmail -bt -C/etc/mail/sendmail.cf

WARNING: local host name (carol3) is not qualified; fix $j in config file
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter

> $j
carol3
> $w
carol3
> $m
Undefined <- so I did not define subdomain.com
> $k
carol3

^D <- enter Cntrl-D to break out.

Golf is a Good Walk Spoiled, Mark Twain.
Geoff Wild
Honored Contributor

Re: send mail

Actually - you only have to stop/start sendmail if it is running.

I prefer to not have it running - unless you need your HP server to receive email...

Set export SENDMAIL_SERVER=0 in /etc/rc.config.d/mailservs

Then add to root's cron:

# Make sure any queued mail is delivered, as sendmail isn't a daemon anymore
39 * * * * /usr/lib/sendmail -q

Rgds...Geoff

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.