javamail

Android Studio: NoClassDefFoundError

 ̄綄美尐妖づ 提交于 2020-01-03 15:58:05
问题 I'm trying to build an app that sends an email using javamail and gmail's smtp service, but when I run it it crashes when I call Session.getInstance. After debugging it appears that it's a NoClassDefFoundError regarding com.sun.mail.util.MailLogger. I read elsewhere that I had to add an older mail package in order to get it, but I'm still getting errors. Here's what I have in Android Studio: // Get system properties Properties properties = System.getProperties(); // Setup mail server

Android Studio: NoClassDefFoundError

我只是一个虾纸丫 提交于 2020-01-03 15:57:39
问题 I'm trying to build an app that sends an email using javamail and gmail's smtp service, but when I run it it crashes when I call Session.getInstance. After debugging it appears that it's a NoClassDefFoundError regarding com.sun.mail.util.MailLogger. I read elsewhere that I had to add an older mail package in order to get it, but I'm still getting errors. Here's what I have in Android Studio: // Get system properties Properties properties = System.getProperties(); // Setup mail server

Java cannot send email with html with images

北城余情 提交于 2020-01-03 04:42:07
问题 I am trying to send email with html which has two images. The two images are sent from the AngularJS client side as base64 strings and looks like: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA+gAAALuCAYAAAA9jTxNAAAgAElEQ Note that I have truncated the base64 string as its too long. String temp = baseString.split(",")[1]; byte[] tile = DatatypeConverter.parseBase64Binary(temp); BodyPart messageBodyPart = new MimeBodyPart(); InputStream inputStream = new ByteArrayInputStream(tile);

Google App Engine (GAE) message.getContent() using javamail and IMAP not works

对着背影说爱祢 提交于 2020-01-03 01:46:08
问题 I have several days trying to get the contents of a message through IMAP on a Google App Engine Project. I managed to extract all the other information, but to extract the contents of jumps me an error message (not work even invoking message.getContent.tostring(), I've tried as MultiPart). I perform the same action from a normal project , (not GAE and using javamail.1.4.7), the content of the messages shown perfectly. This is the code of GAE project: import java.util.Properties; import java

Javamail, IMAP and Kerberos

拜拜、爱过 提交于 2020-01-02 19:28:49
问题 I'm using javamail to check an IMAP inbox, and at the moment I'm simply logging into the IMAP server by storing the username and password. Our security policy at work requires this to be kerberised however. I've been reading up on javamail, IMAP and kerberos, and some resources say it isn't possible, whilst others suggest it is possible. And unfortunately I couldn't find any examples showing how to connect via. kerberos. I was just wondering if anybody could confirm/deny whether it is

How to send html template as mail using groovy

允我心安 提交于 2020-01-02 06:36:09
问题 I am using JavaMail API 1.4.4 to send mails. So far I am able to send the mail, but actually I need to send HTML content so that when the mail is received it processes the html tags. Example: if I have a table code in my message it should process the html code and present it in the mail My Code import java.io.File; import java.util.* import javax.mail.* import javax.mail.internet.* import javax.activation.* class Mail { static void sendMail(mailProp) { // Get system properties Properties

Javamail: can FetchProfile be used when searching mails instead of just fetching them?

点点圈 提交于 2020-01-02 05:17:05
问题 According to http://java.sun.com/products/javamail/javadocs/javax/mail/FetchProfile.html, Message[] msgs = folder.getMessages(); FetchProfile fp = new FetchProfile(); fp.add(FetchProfile.Item.ENVELOPE); folder.fetch(msgs, fp); However, if I want to get only the read messages by using search(), I don't have a means to specify a FetchProfile (as search() doesn't take such a parameter). Folder inbox = store.getFolder("Inbox"); inbox.open(Folder.READ_WRITE); FlagTerm ft = new FlagTerm(new Flags

Reading email from gmail is not working

纵饮孤独 提交于 2020-01-02 05:12:15
问题 I am using Java Mail API along with the following code to read email from my gmail account. import java.util.Properties; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.NoSuchProviderException; import javax.mail.Session; import javax.mail.Store; public class CheckMails { public static void check(String host, String storeType, String user, String password) { try { Properties properties = new Properties(); properties.put("mail.pop3

After update to Android Studio 3.1 the project does not build: Program type already present: com.sun.activation.registries.LineTokenizer

蓝咒 提交于 2020-01-02 04:10:12
问题 I just updated my Android Studio to version 3.1 and I was surprised with an unknown error message: Program type already present: com.sun.activation.registries.LineTokenizer > :testeapn:transformClassesWithDexBuilderForDebug AGPBI: > {"kind":"error","text":"Program type already present: com.sun.activation.registries.LineTokenizer","sources":[{}],"tool":"D8"} > :testeapn:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED > > FAILURE: Build failed with an exception. > > * What went

How to test that the mail server is alive with Java?

微笑、不失礼 提交于 2020-01-02 02:42:09
问题 Is there a way with JavaMail API to check that the mail server used is alive ? If not, how do to it with Java code ? Thanks by advance for your help. 回答1: If you've got a reference to a Session instance, you could do the following: Session s = //a JavaMail session I got from somewhere boolean isConnected = s.getTransport("smtp").isConnected(); If the mail client is connected to the appropriate SMTP server, it usually means it's alive. 回答2: From the JavaMail API, you could try sending an email