public static ProcessReturn sendEmail_Unix ( String target , String topic , String text ) throws OSHelperException { topic = topic . replaceAll ( "\"" , "\\\"" ) ; String emailCommandAsString = "mail -s \"" + topic + "\" -S sendcharsets=utf-8 " + target ; List < String > emailCommandAsList = OSHelper . constructCommandAsList_Unix_sh ( emailCommandAsString ) ; Process process = OSHelper . runCommand ( emailCommandAsList ) ; OutputStream processStdin = process . getOutputStream ( ) ; try { processStdin . write ( text . getBytes ( ) ) ; } catch ( IOException ex ) { throw new OSHelperException ( ex ) ; } try { processStdin . close ( ) ; } catch ( IOException ex ) { throw new OSHelperException ( ex ) ; } ProcessReturn processReturn = OSHelper . procWaitWithProcessReturn ( process , 10000 ) ; return processReturn ; }
Send a simple email