Hello,
I 've written a library, which is transmitted directly from my program B4A an email. Under the Eclipse class works fine when I imagine an instance in the main and execution. The compilation is without error. My B4A test programs can be found all members and can be compiled without error. On my device, will test the program but dropped out of the above error message.
Bottom of the log is the following error
I could isolate the error to find the following method, but not make the mistake!
The authentication is done with the following code.
The error caused by my library. I think this is a failed authentication. Deck is right I oer my fault somewhere else? Without your help I think the mistake before. Thanks for your help in advance.
best regards
Amalkotey
I 've written a library, which is transmitted directly from my program B4A an email. Under the Eclipse class works fine when I imagine an instance in the main and execution. The compilation is without error. My B4A test programs can be found all members and can be compiled without error. On my device, will test the program but dropped out of the above error message.
Bottom of the log is the following error
B4X:
Start proc esdaSO.LibraryDemo.SendTheMail for activity esdaSO.LibraryDemo.SendTheMail/.main: pid=28464 uid=10144 gids={1015}
FATAL EXCEPTION: main
java.lang.VerifyError: esdaSO.Android.Lib.SendTheMail
at esdaSO.LibraryDemo.SendTheMail.main._globals(main.java:304)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:105)
at esdaSO.LibraryDemo.SendTheMail.main.initializeGlobals(main.java:201)
at esdaSO.LibraryDemo.SendTheMail.main.afterFirstLayout(main.java:81)
at esdaSO.LibraryDemo.SendTheMail.main.access$100(main.java:16)
at esdaSO.LibraryDemo.SendTheMail.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Force finishing activity esdaSO.LibraryDemo.SendTheMail/.main
I could isolate the error to find the following method, but not make the mistake!
B4X:
private void SendMailWithoutAttachments() {
Authenticator authenticator = null;
try {
lastError = "";
//Set the host smtp address
Properties props = new Properties();
props.put("mail.smtp.host", SMTPHost);
if (auth == true)
props.put("mail.smtp.auth", "true");
else
props.put("mail.smtp.auth", "false");
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.port", Port.toString());
if (auth == true) {
authenticator = new SMTPAuthenticator();
}
Session session = Session.getInstance(props, authenticator);
// create a message
Message msg = new MimeMessage(session);
// set the from and to address
InternetAddress addressFrom = new InternetAddress(SenderMailAdress);
msg.setFrom(addressFrom);
// Set the Receiver mail adresses
InternetAddress[] addressTo = new InternetAddress[To.getSize()];
for (int i = 0; i < To.getSize(); i++) {
addressTo[i] = new InternetAddress((String) To.Get(i));
}
msg.setRecipients(MimeMessage.RecipientType.TO, addressTo);
// Setting the Subject and Content Type
msg.setSubject(Subject);
if (htmlMail == true)
msg.setContent(MsgText, CONTENT_HTML);
else
msg.setContent(MsgText, CONTENT_TEXT);
}
Transport.send(msg);
} catch (MessagingException mex) {
mex.printStackTrace();
lastError = "Method: sendMail" + crLF + mex.toString();
Exception ex = null;
if ((ex = mex.getNextException()) != null) {
ex.printStackTrace();
lastError = "Method: sendMail" + crLF + ex.toString();
}
}
}
The authentication is done with the following code.
B4X:
public class SMTPAuthenticator extends javax.mail.Authenticator {
private PasswordAuthentication authentication;
public SMTPAuthenticator() {
authentication = new PasswordAuthentication(UserName, Password);
}
protected PasswordAuthentication getPasswordAuthentication() {
return authentication;
}
}
The error caused by my library. I think this is a failed authentication. Deck is right I oer my fault somewhere else? Without your help I think the mistake before. Thanks for your help in advance.
best regards
Amalkotey
Last edited: