I try the following script:
try {
var cryptoobj = aqua.crypto.getSecureField('ieg');
var smtpserver = aqua.mail.getDefaultServerSMTP();
smtpserver.setUserName('ivangron@gmail.com');
smtpserver.setPassword(cryptoobj);
var msg1 = aqua.mail.newMessage();
msg1.addTo("ivangron@aquafold.com"); // set email address
msg1.setFrom("ivangron@aquafold.com"); // set email address
msg1.setSubject("Test - Default MAIL QUEUE SMTP");
msg1.setText("This is a test");
smtpserver.sendMail(msg1);
} catch ( e ) {
print(e);
aqua.exit();
}
I get the following exception:
JavaException: javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.AuthenticationFailedException
Under file->options->E-mail->I don't put the username and password here. So when I create aqua.mail.getDefaultServerSMTP() object, my question is should i be able to change the value of username and password?
if not, when i try and setUserName or any set method that wont actually except the value, should i get an exception to console so that I know it didn't work?
It turned out that the implementation of SMTP server (not implemented by me) won't allow you to change the default settings. I will talk to Niels to see what is best way to address this issue.
I made changes in AQSmtpServer so that application can change the settings of the SMTP server instance returned by aqua.mail.getDefaultServerSMTP(), just within the context of that instance.
I added validation to the setter methods as follows:
- setHost() : cannot be blank
- setPort() : should be > 0
- when setUseAuthentication() is set to true
. setUserName() : cannot be blank
. setPassword() : cannot be blank
Please note that if host/port/userName/password are presented, we won't be able to verify their correctness until sendMail() is called.
I also added getter methods (but not for getPassword()) so that application can retrieve settings from the SMTP server instance.
Change above is available as revision 14474 of trunk/ADS.
I made changes in AQSmtpServer so that application can change the settings of the SMTP server instance returned by aqua.mail.getDefaultServerSMTP(), just within the context of that instance.
I added validation to the setter methods as follows:
- setHost() : cannot be blank
- setPort() : should be > 0
- when setUseAuthentication() is set to true
. setUserName() : cannot be blank
. setPassword() : cannot be blank
Please note that if host/port/userName/password are presented, we won't be able to verify their correctness until sendMail() is called.
I also added getter methods (but not for getPassword()) so that application can retrieve settings from the SMTP server instance.
Change above is available as revision 14474 of trunk/ADS.
VERY BAD!!!
OK, so i'm allowed to change the user and password now, this is good and itworks fine. can not have a getter method for user name or anything that excepts an object to be set as value, opaque values basically, or i can set the username to the password and then print the username and get the password that shouldn't be able to happen for security issues...
other then making sure not to have that getter method, seems to work well...
VERY BAD!!!
OK, so i'm allowed to change the user and password now, this is good and itworks fine. can not have a getter method for user name or anything that excepts an object to be set as value, opaque values basically, or i can set the username to the password and then print the username and get the password that shouldn't be able to happen for security issues...
other then making sure not to have that getter method, seems to work well...
The getUserName() method now is removed from both interface and implementation classes in turnk/ADS:
Sending src-rep\src\lib\aqua-core\com\aquafold\aquacore\open\mail\CoreSmtpServer.java
Sending src-rep\src\lib\aqua-open\com\aquafold\openapi\mail\AQSmtpServer.java
Transmitting file data ..
Committed revision 14528.
The getUserName() method now is removed from both interface and implementation classes in turnk/ADS:
Sending src-rep\src\lib\aqua-core\com\aquafold\aquacore\open\mail\CoreSmtpServer.java
Sending src-rep\src\lib\aqua-open\com\aquafold\openapi\mail\AQSmtpServer.java
Transmitting file data ..
Committed revision 14528.
Issue #4130 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
No fixed build |
No time estimate |
It turned out that the implementation of SMTP server (not implemented by me) won't allow you to change the default settings. I will talk to Niels to see what is best way to address this issue.