我需要使用sendEmail(http://caspian.dotconf.net/menu/Software/SendEmail/)从java发送电子邮件,但是当我尝试发送它时,我收到此错误
sendEmail [11869]:错误:“ - ”不是公认的选项!
但如果我在控制台中放入相同的命令(从日志中复制并粘贴命令),它可以正常工作。
这是我的代码:
String comm = "/opt/bin/sendEmail "
+ "-f \"***@***.com\" "
+ "-u \"REPORT\" "
+ "-m \"Report\" "
+ "-a \""+ pdfFileName +"\" "
+ "-s \"" host +"\" "
+ "-xu \""+ user +"\" "
+ "-xp \""+ password +"\" ";
for(String t:recipients)
comm += "-t \""+ t +"\" ";
log.info(comm); // It is correct! if i paste it in console it works
StringBuffer output = new StringBuffer();
Process p = Runtime.getRuntime().exec(comm);
p.waitFor();
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = "";
while ((line = reader.readLine())!= null) {
output.append(line + "\n");
}
我在哪里做错了? 感谢