1833877 Members
2308 Online
110063 Solutions
New Discussion

Re: mailx working or not

 
SOLVED
Go to solution
Ahmed_41
Super Advisor

mailx working or not

Dear All,

i am trying to test sending emails from command line using mailx
mailx -s"hii" ov@mailservers IP <body
EOT

this mailserver is on another machine
the idea is i do that and i dont find email received in the mailbox and also the mailx command doesnot give any error

i also checked that sendmail is up by doing telent on my machine on port 25 to check that smtp deamon is running so as mailx can send via smtp, is there anything else i need to check on my machine to get sure i can send properly ???

or is there a better way to send an email using a command ?? as i will use this later in Open View
thanks in advance
20 REPLIES 20
harry d brown jr
Honored Contributor

Re: mailx working or not

You should use uuencode and the -m option on mailx:

uuencode body.file body.txt | mailx -m -s "test" ov@mailservers

try that.

live free or die
harry


Live Free or Die
Georg Tresselt
Honored Contributor

Re: mailx working or not

Any difference if you use the FQDN of your mailserver?
http://www.tresselt.eu
Ahmed_41
Super Advisor

Re: mailx working or not

Guys,
these options didnot work
is there anything needed on the HPUX machine except the sendmail to be up ?? and is there any special configuration in the sendmail to be done in order to be able to send emails ??


or let me ask you the question from another point
this is a new machine just installed HPUX on it, what do i need to do to be able to send emails from it to another mailserver on the network ??


thanks
harry d brown jr
Honored Contributor
Solution

Re: mailx working or not

Copy a working /etc/mail/sendmail.cf file to the new machine.

and make sure sendmail is running:
ps -ef | grep sendmail


live free or die
harry d brown jr
Live Free or Die
Fred Ruffet
Honored Contributor

Re: mailx working or not

You may just need to set up SMTP server in sendmail.cf file. This file can be found in /etc/mail directory. You will find a line in it, beginning with DS. You need to put your SMTP server name on this line ( nospace betwen DS and name). Then restart sendmail (kill -1 may be enough).

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Ahmed_41
Super Advisor

Re: mailx working or not

guys i am very greatful for your help

first of all it seems my file .cf is very pure file, so can someone send me a configurerd one,
second which is very important
i am doing this scenario, i have a HPUX machine i am running OV on it, i need to be able to send emails from this machine to a mailserver, IE my HPUX machine will not work as a mail server, i will just issue the mailx command from it

so regarding this scenario did your solution make it or not ??

again, my HPUX machine will not be a mail server, while i will just send emails from it, so to do this job what is needed, please advice.

thanks
Fred Ruffet
Honored Contributor

Re: mailx working or not

Even if you just want to use mailx, you need
to tell the server to which other server he will have to queue the messages. This is done by adding the SMTP server name (mailserver) and kill -1 sendmail.

Starting from default sendmail.cf file and editing DS line should be OK.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Ahmed_41
Super Advisor

Re: mailx working or not

Fred
i did that right now and still i am unable to send emails

i simply issue this command mailx with the options i stated before and you know HPUX just gives back the prompt and nothing more and when you check your mailbox on the other mahcine there is nothing there


any comments ?? is there anything else needed to be done ?
Steven E. Protter
Exalted Contributor

Re: mailx working or not

There should be error messages in the file /var/adm/syslog/mail.log

These will be very helpful in diagnosing this issue.

I'm attaching a flexible sendmail script that sends attachments.

mailq

and

sendmail -v -q

output would be useful in diagnosis.

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
Fred Ruffet
Honored Contributor

Re: mailx working or not

Could you post tail of /var/adm/syslog/mail.log ?

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Ahmed_41
Super Advisor

Re: mailx working or not

dear all
here is the log file
i noticed there is something related to the domain name of the machine

is there any option so as i wont change the machine name, as changing the machine name now will make me need to reinstall the whole applications which is a crisis

is there a way to resolve the error without changing the machine name ??

thanks
Steven E. Protter
Exalted Contributor

Re: mailx working or not

The error indicates a conflict between the system host name in /etc/rc.config.d/netconf and your sendmail.cf file.

This name may be incompatible with or conflict with your DNS servers, connected in /etc/resolv.conf

Also see /etc/nsswitch.conf and make sure host name resolution is correct.

Simple way to fix is to set the Dj directive in sendmail.cf

Djhostname

save the config file.

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

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
RAC_1
Honored Contributor

Re: mailx working or not

/usr/sbin/expand_alias ov@mailservers

Does it return OK?? also what if you send email to some other user?? does it get delivered.

Anil
There is no substitute to HARDWORK
Ahmed_41
Super Advisor

Re: mailx working or not

guys
thanks for the answers but still i am having some problems,
check the attached logs, now there is no error regarding the domain name, mails are now queded but they never reach the intended user
also i attached the .cf file of my sendmail, i still cannot recieve emails,
can you please have a look to the sendmail.cf and to the log and tell me now why it is not working ???

beside guys, isnt it supposed to tell my HPUX machine what is its outgoing smtp server ?? where do you define this ?
Fred Ruffet
Honored Contributor

Re: mailx working or not

outgoing smtp server IS the one specified by the DS line in sendmail.cf

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Fred Ruffet
Honored Contributor

Re: mailx working or not

uncomment this line in sendmail.cf :
# Djcitystars-com.COM
(remove leading # car)

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Ahmed_41
Super Advisor

Re: mailx working or not

Fred,
i did what you said and i am still unable to send, mails are queed and never sent

i tried to do mailx with debugging and here is the result, can you guys check it, someone tell me guys will i be able to send an email ever from this machine :)




# mailx -d -m -s"hii" ov@citystars-com.com <> testing mailx
> EOT
assign(debug)=
assign(SHELL)=/sbin/sh
value(TMPDIR)=
value(HOME)=/
value(MBOX)=
value(HOME)=/
assign(MBOX)=//mbox
value(MAILRC)=
value(HOME)=/
assign(MAILRC)=//.mailrc
value(DEAD)=
value(HOME)=/
assign(DEAD)=//dead.letter
assign(save)=
assign(asksub)=
assign(header)=
value(flipr)=
value(autoprint)=
value(flipr)=
value(autoprint)=
value(flipr)=
assign(append)=
value(autoprint)=
value(flipr)=
assign(asksub)=
value(autoprint)=
value(flipr)=
assign(dot)=
value(autoprint)=
value(flipr)=
assign(crt)=21
value(autoprint)=
value(flipr)=
assign(PAGER)=/usr/bin/more
value(autoprint)=
value(flipr)=
assign(save)=
value(autoprint)=
value(flipr)=
assign(encoding)=8bit
value(autoprint)=
value(MAILRC)=//.mailrc
value(flipr)=
assign(dot)=
value(autoprint)=
value(flipr)=
assign(append)=
value(autoprint)=
value(flipr)=
assign(save)=
value(autoprint)=
value(flipr)=
assign(PAGER)=/usr/bin/more
value(autoprint)=
value(flipr)=
assign(asksub)=
value(autoprint)=
value(flipr)=
assign(crt)=21
value(autoprint)=
value(flipr)=
assign(encoding)=8bit
value(autoprint)=
value(flipr)=
value(autoprint)=
value(flipr)=
assign(messageseparator)=NewLine
value(autoprint)=
value(flipr)=
assign(retrieveinterval)=5
value(autoprint)=
value(flipr)=
assign(saveinterval)=12
value(autoprint)=
value(charset)=
charset set to 'us-ascii'.
value(encoding)=8bit
encoding set to '8bit'.
value(outfolder)=
value(record)=
recfile=''
value(DEAD)=//dead.letter
value(replyto)=
value(ignore)=
value(escape)=
value(metoo)=
value(conv)=
Should be inserting commas in recip lists
detract asked to insert commas
detract asked to insert commas
value(charset)=
charset set to 'us-ascii'.
value(encoding)=8bit
encoding set to '8bit'.
value(mimeheader)=
value(metoo)=
Recipients of message:
"sendmail" "-oi" "ov@citystars-com.com"
value(sendwait)=
value(sendmail)=
#



Fred Ruffet
Honored Contributor

Re: mailx working or not

which user are you sending mail with ?

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
D Block 2
Respected Contributor

Re: mailx working or not

Ahmed,

I am throwing a number of things out here
with some hopes of helping. try each one if you can. sounds like your DNS, Domain names have to be correct before doing any of these commands below.

try using the -bt option for debugging:
# sendmail -bv youruser@yourhost.com

-bv option processes an addr through sendmail and display the mail delivery Triple for that address:
-------------------------------------
try doing an: SNMPWALK to your OV box:
snmpwalk -c public system

-------------------------------------
try doing a Telnet Hello check

# telnet yourrelaybox.yourdomain.com smtp

HELO yourreolaybox.yourdomain.com

MAIL From:

RCPT To:

QUIT

--------------------------------------
try seeing your key definitions and look these up from O'Rielly SendMail book:

sendmail -bt -C/etc/mail/sendmail.cf
> $j
foo.mydomain.com
> $w
foo
> $m
mydomain.com
> $k
foo

=M
(short domain name) $w = mccarol
(canonical domain name) $j = mccarol
(subdomain name) $m =
(node name) $k = mccarol
--------------------------------------


try this links below:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=76524

here's great link:
http://www.docs.hp.com/cgi-bin/fsearch/framedisplay?top=/hpux/onlinedocs/B2355-90685/B2355-90685_top.html&con=/hpux/onlinedocs/B2355-90685/00/00/35-con.html&toc=/hpux/onlinedocs/B2355-90685/00/00/35-toc.html&searchterms=sendmail&queryid=20030116-075129
Golf is a Good Walk Spoiled, Mark Twain.
Fred Ruffet
Honored Contributor

Re: mailx working or not

It's still morning for me and maybe not totaly up, but something strange in your last mail.log/sendmail.cf : your SMTP server in sendmail.cf is OVSV2NOC2RK1 and your logging server in mail.log is OVSV2NOC2RK1 which is the same !
Are you really mailing from SMTP server. That's not what I understand from preceding post. You may not have a correct DS conf.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)