javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/mixed; boundary

JavaMail depends on some configuration files to map MIME types to Java classes (e.g., multipart/mixed to javax.mail.internet.MimeMultipart). These configuration files are loaded using the ClassLoader for the application. If the ClassLoader doesn’t function properly, these configuration files won’t be found. You can simply add below lines .. that solves the issue . MailcapCommandMap mc = … Read more

Send mail in javax.mail without authentication

private void createSession() { properties.put(“mail.smtp.auth”, “false”); //Put below to false, if no https is needed properties.put(“mail.smtp.starttls.enable”, “true”); properties.put(“mail.smtp.host”, server); properties.put(“mail.smtp.port”, port); session = Session.getInstance(properties); } I think, this would suffice.

Using Javamail to connect to Gmail smtp server ignores specified port and tries to use 25

In Java you would do something similar to: Transport transport = session.getTransport(“smtps”); transport.connect (smtp_host, smtp_port, smtp_username, smtp_password); transport.sendMessage(msg, msg.getAllRecipients()); transport.close(); Note ‘smtpS’ protocol. Also socketFactory properties is no longer necessary in modern JVMs but you might need to set ‘mail.smtps.auth’ and ‘mail.smtps.starttls.enable’ to ‘true’ for Gmail. ‘mail.smtps.debug’ could be helpful too.

Is there a work around google disabling “Less secure apps”?

You could try authentification via “App password”. On your Google account: set 2-Step Verification ON create 16-character “App password”( How to create app password) -> result should be similar to: 16-character “App password” Instead of Google account password use 16-character password MailMessage mail = new MailMessage(); foreach (string receiver in DolociPrejemnike()) mail.To.Add(receiver); mail.From = new … Read more

Error in JavaMail : PKIX path building failed unable to find valid certification path to requested target

Ok problem solved! The solution is this: First get the self-signed certificate from the mail server via openssl: echo | openssl s_client -connect yoursever:port 2>&1 | sed -ne ‘/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p’ > yourcert.pem Then save the yourcert.pem file into this path /Library/Java/Home/lib/security (on macOSX) and put the cert file into the cacerts like this keytool … Read more

tech