Usage of sendmail utility in AIX using Runtime.exec()

Hi,

I am trying to send a mail using mail/mailx utility through java Runtime.exec..I couldn't send a message located in a separate file

my code:

Runtime rt = Runtime.getRuntime();

Process proc = rt.exec("mailx -s "email-subject" id@dot.com <temp.txt );

contents of temp.txt :

Auto-generated mail

result:

mail has been sent to id@dot.com

message looks like

From:me@dot.com

To:><temp.txt@dot.com; id@dot.com

subject:email-subject

Body-Content: ><empty>

Expected result:

From:me@dot.com

To:id@dot.com

subject: email-subject

Body-Content: Auto-generated mail

when i try the same command in shell i get the correct result.

please help me to solve this.

Thanks in advance,

Subbu

[835 byte] By [Subbu@suna] at [2007-11-27 6:15:37]
# 1
it can be solved in this wayString [] cmd=new String[3];cmd[0]="/bin/sh";cmd[1]="-c";cmd[2]="email -s ....................<msg.txt";Runtime.getRuntime().exec(cmd);>
Subbu@suna at 2007-7-12 17:26:28 > top of Java-index,Desktop,Runtime Environment...