javamail

JavaMail BaseEncode64 Error

强颜欢笑 提交于 2019-12-19 18:56:55
问题 I'm currently developing an application which download attachment from gmail account. Right now, I got error whenever downloading zipped attachment. But, not all, some I can retrieve it without error. Here's the Exception message: Exception in thread "main" com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed 4 valid base64 characters but only got 1 before EOF, the 10 most recent characters were: "Q3w5ilxj2P" FYI: I was able to download the attachment via gmail

Android JavaMail application - CertPathValidatorException: Trust anchor for certification path not found

我与影子孤独终老i 提交于 2019-12-19 11:59:31
问题 Please, before making this a duplicate, read my problem. I have read many questions and answers about this error when using self signed certificates. But, my problem is that I get this error when trying to connect to GMAIL imap server. So, I really need some help. My code is: private String[] ReadMailbox(String MailboxName) throws IOException { Properties props = new Properties(); props.setProperty("mail.store.protocol", "imaps"); props.setProperty("mail.imaps.port", "993"); List<String>

How to get rid of 'Failed to load IMAP envelope' Messaging Exception?

北战南征 提交于 2019-12-19 11:48:55
问题 I am trying to get the list of emails by Message msg[] = folder.getMessages(); . After that I am getting the details of each message, meanwhile I am getting javax.mail.MessagingException: Failed to load IMAP envelope exception for some message. This is protocol trace for the one message which producing error - A7 FETCH 2 (ENVELOPE INTERNALDATE RFC822.SIZE) * 2 FETCH (RFC822.SIZE 2567 INTERNALDATE "29-Apr-2011 13:49:01 +0000" ENVELOPE ("Fri, 29 Apr 2011 19:19:01 +0530" "I NEES YOUR ASSISANCE??

How to use Javamail for accessing additional mailboxes (IMAP, Exchange 2010)

自闭症网瘾萝莉.ら 提交于 2019-12-19 10:42:52
问题 I want to access a shared mailbox (NOT FOLDER) via Javamail API (1.4.5) using IMAP(s) with plain logon. The mailserver is a Exchange Server 2010. User: user1 (user1@domain.com) pwd: xxxx shared mailbox: shared_MB@domain.com I´ve managed to get access to the user1 - mailbox: Session session = Session.getInstance(properties, new ExchangeAuthenticator(username, password)); session.setDebug(true); Store store = session.getStore("imaps"); store.connect(imapHost, username, password); properties:

Send a mail with java and gmail [duplicate]

[亡魂溺海] 提交于 2019-12-19 10:19:15
问题 This question already has answers here : Sending Email via gmail smtp server in JAVA (4 answers) Closed 6 years ago . I wanto to send a e-mail with an calendar attachment javaxmail and I created this class: public void sendEmail(String to, Calendar calendar) { try { String d_uname = "myaccount@gmail.com"; String d_password = "mypassword"; String d_host = "smtp.gmail.com"; String d_port = "587";//465,587 String from = "antonitocea@gmail.com"; String subject = "Subject"; String bodyText = "Body

Java mail how to send automatically an email on condition

青春壹個敷衍的年華 提交于 2019-12-19 08:20:11
问题 Never used Java mail before. In my JSF web app, I have an entity (followUp) with a property private Date checkDate; that corresponds to an Animal entity. (An Animal has many followup records). Otherwise: The user must each 3 months create a new record in {followUp} and mark it as checked and supply the date of his action which is "checkDate". But since the user is so lazy, he does that for only few Animals. So he actually wants to be alerted by email for Animals that have not been checked for

IMAP access to mail office 365 with javamail

早过忘川 提交于 2019-12-19 07:50:12
问题 I'm trying to read the emails in a folder of an email account Office365 using JavaMail 1.4 api. My code is: public static void main(String argv[]) throws Exception { // Get a Properties object Properties props = System.getProperties(); // Get a Session object Session session = Session.getInstance(props, null); // Get a Store object Store store = null; Folder rf = null; if (CUR_MAIL_PROTOCOL != null) store = session.getStore("imap"); // Connect if (CUR_MAIL_HOST != null || CUR_MAIL_LOGIN !=

IMAP access to mail office 365 with javamail

那年仲夏 提交于 2019-12-19 07:50:09
问题 I'm trying to read the emails in a folder of an email account Office365 using JavaMail 1.4 api. My code is: public static void main(String argv[]) throws Exception { // Get a Properties object Properties props = System.getProperties(); // Get a Session object Session session = Session.getInstance(props, null); // Get a Store object Store store = null; Folder rf = null; if (CUR_MAIL_PROTOCOL != null) store = session.getStore("imap"); // Connect if (CUR_MAIL_HOST != null || CUR_MAIL_LOGIN !=

How to use SpringTemplateEngine when using Spring Boot

拈花ヽ惹草 提交于 2019-12-18 11:34:32
问题 I am using Thymeleaf SpringTemplateEngine to create a HTML e-mail on my Spring application. When I was using pure Spring MVC everything was perfect. Now with Spring Boot the class can't find my .html template. I think the problem is with ServletContext that is not returning the right path, but I can't figure out how to resolve it. So should I use another Context to process the template? Which one? This is my MailService working for pure Spring MVC. @Service public class MailService { private

How to set the Return-Path to an email address other than Sender address using JavaMail?

此生再无相见时 提交于 2019-12-18 10:44:18
问题 How to set the Return-Path to an email address other than Sender address using JavaMail? 回答1: The code below does what you want, and does it in the correct way. Reread what you yourself posted in the comment From: RFC2821: 4.4 Trace Information When the delivery SMTP server makes the "final delivery" of a message, it inserts a return-path line at the beginning of the mail data. This use of return-path is required; mail systems MUST support it. The return-path line preserves the information in