18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Send E-mail using Javamail problems & questions
OS name: Windows
Browser name and version: IE 9
Sahi build number: 2013-04-29
Hello,
I am trying to send e-mail using Javamail and having a hard time. I've searched Sahi Forum and read every discussion in the result, but I still have a few questions to ask.
I think I configured external class path correctly, Mailer constructor is being called, but I cannot send an e-mail. It stucks inside send() function in Mailer class.
My Question is:
1. I saw some example code for sending e-mails in Sahi, and I see the 5th parameter called $isSSL. (ex - http://sahi.co.in/docs/troubleshooting/send-email-issues.html)
However, when I add the fifth parameter, I get:
Inside Mailer.java I don't see the fifth param, and any configuration to Javamail for SSL. Am I running the old version of Sahi or something? What should I do if SSL is required (ex, GMail with port 465)
2. As a solution to Q1, I modified Mailer.java file in notepad:
However, the changes I made were not being called, or applied. How do I customize the Mailer.java file? I wonder if Java needs to be compiled after the changes in order to use the updated class? Could you explain the steps? Or is it not possible/recommended to customize Mailer.java file?
I don't know what i'm doing wrong, any help would be appreciated.
Browser name and version: IE 9
Sahi build number: 2013-04-29
Hello,
I am trying to send e-mail using Javamail and having a hard time. I've searched Sahi Forum and read every discussion in the result, but I still have a few questions to ask.
I think I configured external class path correctly, Mailer constructor is being called, but I cannot send an e-mail. It stucks inside send() function in Mailer class.
My Question is:
1. I saw some example code for sending e-mails in Sahi, and I see the 5th parameter called $isSSL. (ex - http://sahi.co.in/docs/troubleshooting/send-email-issues.html)
However, when I add the fifth parameter, I get:
Java constructor for "net.sf.sahi.ant.Mailer" with arguments "string,number,string,string,boolean" not found. (RhinoScriptRunner.run#292)
Inside Mailer.java I don't see the fifth param, and any configuration to Javamail for SSL. Am I running the old version of Sahi or something? What should I do if SSL is required (ex, GMail with port 465)
2. As a solution to Q1, I modified Mailer.java file in notepad:
sahi\src\net\sf\sahi\ant\Mailer.java
However, the changes I made were not being called, or applied. How do I customize the Mailer.java file? I wonder if Java needs to be compiled after the changes in order to use the updated class? Could you explain the steps? Or is it not possible/recommended to customize Mailer.java file?
I don't know what i'm doing wrong, any help would be appreciated.
Answers
As a solution, I had to do these:
1. Update Mailer.java with text editor. This site was very helpful: http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/
*For Password Authentication, I also had to add this line to the Mailer.java file.
2. Navigate to sahi\src\net\sf\sahi\ant\ and compile Mailer.java running javac command. This will generate .class file(s). You may need to download java or set environment variable in order to run javac command.
This is the command I used:
3. Extract sahi\lib\ant-sahi.jar and navigate to Mailer.class file
4. Copy & Paste the class file(s) you generated in step #2.
5. Compress the 'net' folder you extracted to a new ant-sahi.jar file. Here is the command I used:
6. Copy & Paste the jar in step #5 to the sahi/lib folder.
Hope this helps.