Email related issues
sendEmail fails for Microsoft Outlook with Permission denied: connect error
symptom
When sending an email from my outlook server using sendEmail, I keep getting a connect error. (101145)
The code for sendEmail is as follows.
We do not need authentication and the server can be connected via telnet.
ERROR [110 ms] [11:40:53.546]
Wrapped javax.mail.MessagingException: Could not connect to SMTP host: 192.168.1.12, port: 25;
nested exception is:
java.net.SocketException: Permission denied: connectThe code for sendEmail is as follows.
function sendEmail($emailSubject, $emailBody) {
      var $host = "192.168.1.12";
      var $port = 25;
      var $username = "";
      var $password = "";
      var $isSSL = false; // set to true if you use SSL
      var $mailer = new Packages.net.sf.sahi.ant.Mailer($host, $port, $username, $password, $isSSL);
      var $from = "sahi_test@example.com";
      var $to = "sahisupport@example.com";
      $mailer.send($from, $to, $emailSubject, $emailBody);
}
sendEmail("Mail from Sahi", "Script Run");We do not need authentication and the server can be connected via telnet.
resolution
    - Verify that all the values used in sendEmail are correct.
- 
There is an issue with Java 1.7 which may cause this problem.
 
 Please try the following.- 
Take a backup of bin\dashboard.bat.
- 
Edit dashboard.bat. Replace this line
 withjava -classpath %SAHI_EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.ui.Dashboard "%SAHI_HOME%" "%SAHI_USERDATA_DIR_TMP%"java -classpath %SAHI_EXT_CLASS_PATH%;%SAHI_CLASS_PATH% -Djava.net.preferIPv4Stack=true net.sf.sahi.ui.Dashboard "%SAHI_HOME%" "%SAHI_USERDATA_DIR_TMP%"
 
 We have added -Djava.net.preferIPv4Stack=true.
- Restart Sahi by launching start_dashboard.bat
- Check if you are able to send email.
 
- 
Take a backup of 
- 
If this does NOT work, try the following too. Here we are forcing Sahi to use an older version of Java - either 1.5.x or 1.6.x.
- Revert changes to dashboard.bat that you did in the above steps.
- 
Take a backup of userdata\bin\setjava.bat.
- Edit setjava.bat. Change the value of SAHI_JAVA_HOME to point to a lesser JRE version, may be 1.6.
- Restart Sahi by launching start_dashboard.bat
- Check if you are able to send email
 
