Operating System - HP-UX
1753449 Members
5932 Online
108794 Solutions
New Discussion юеВ

I want send mails form command line

 
Rogelio Cabrera
Frequent Advisor

I want send mails form command line

Hola.
I have a old server hp-9000 running hp-ux 11.0.
I want send mails from command line using command mailx or sendmail no matter.
I should check? and which command do you recommend?
On another server, with linux SO, I use:
#mail user@mail.com -s "Subject" < file.txt
I want something like the above for my hp-ux server

17 REPLIES 17
Patrick Wallek
Honored Contributor

Re: I want send mails form command line

Have you tried using mailx to send mail? Did it work? Check /var/adm/syslog/mail.log for errors.

On my systems:

mailx -s "Subject" user@mail.com < file.txt

works fine.

If the mail messages are not sent, then there may be sendmail configuration required. The entries from the mail.log file will help diagnose any problem encountered when sending mail.
Rogelio Cabrera
Frequent Advisor

Re: I want send mails form command line

Thanks Patrick.
Sent you my log file and I hope someone help me.
James R. Ferguson
Acclaimed Contributor

Re: I want send mails form command line

Hi:

From your mail log, it looks like you want to send mail to the external world. Configure the "smart relay" macro in '/etc/mail/sendmail.cf'. Make sure that your DNS works and you should be able to do:

# mailx -s "Hello!" root,rcabrera@ggp.com < /dev/null

The 'DS' macro should look something like this:

DSexchange.xyz.com

...where in this example, 'exchange.xyz.com' would be the name of my Exchange mail server.

Regards!

...JRF...
Rogelio Cabrera
Frequent Advisor

Re: I want send mails form command line

OK.
I edit the file and save it.
I need to restore some service?
James R. Ferguson
Acclaimed Contributor

Re: I want send mails form command line

Hi (again):

If 'sendmail' is running as a daemon, do:

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

Otherwise, you shouldn't need to do this.

Regards!

...JRF...
Rogelio Cabrera
Frequent Advisor

Re: I want send mails form command line

Hi, Try sending again and
No, still not sent.
send the log file again.

#ps -ef | grep sendmail
root 4833 1 0 18:02:10 ? 0:00 sendmail: accepting connections
on port 25
#
Not knowing that this failing. :-(
Thanks.
Bill Hassell
Honored Contributor

Re: I want send mails form command line

The mail.log does not seem to show a mail relay server. Do you have a Microsoft Exchange system on your network? If true, then the DS line in sendmail.cf will show that server's name or IP address. If you do not have an Exchange (or Lotus Notes) server, then contact your Internet service provider to ask about their mail relay system.

You can see the mail transactions by using sendmail directly:

# /usr/sbin/sendmail -v bill@bill.com < /etc/issue

You will see the reason your mail is failing.


Bill Hassell, sysadmin
Rogelio Cabrera
Frequent Advisor

Re: I want send mails form command line

Thanks Bill.
I did as you indicated and got the following:
/#>/usr/sbin/sendmail -v rcabrera@ggp.com.mx < /etc/issue
/etc/mail/sendmail.cf: line 0: WARNING: writable directory /etc
/etc/mail/sendmail.cf: line 662: WARNING: writable directory /etc
/etc/mail/sendmail.cf: line 665: WARNING: writable directory /etc
WARNING: writable directory /var
WARNING: writable directory /etc
rcabrera@ggp.com.mx... ggp.com.mx: Name server timeout
rcabrera@ggp.com.mx... Transient parse error -- message queued for future delivery
rcabrera@ggp.com.mx... queued
WARNING: writable directory /etc

I have Microsoft Exchange Server 2007/64 in my network; her name is "mail.ggp.com.mx" and
on file "/etc/mail/sendmail.cf" I have the line: DSmail.ggp.com.mx
Is correct??
Regards :-)
Rita C Workman
Honored Contributor

Re: I want send mails form command line

I don't think 'your' email address is rcarbera@ggp.com.mx though.

So, also please adjust the DM line to say:
DMggp.com

See if that helps,
Rita