javamail

Java mail sending error? [closed]

China☆狼群 提交于 2020-01-05 08:48:37
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I developed a sample mail program in Java. While sending mail, it throws exception like "553 from address not verified". How do I resolve? 回答1: com.sun.mail.smtp.SMTPSendFailedException: 553 From address not

Save Draft Message Using Java Mail API?

末鹿安然 提交于 2020-01-05 08:26:26
问题 Currently im doing as following, @Override public void saveDraftMessage(MimeMessage draftMessage) throws MessagingException { Folder draftsMailBoxFolder = imapsStore.getFolder("inbox");//[Gmail]/Drafts draftsMailBoxFolder.open(Folder.READ_WRITE); draftMessage.setFlag(Flag.DRAFT, true); MimeMessage draftMessages[] = {draftMessage}; draftsMailBoxFolder.appendMessages(draftMessages); } It works but , as you could see message is being appended to "inbox" folder without complain from server end !

get email attatchment for POP 3 received as winmail.dat

萝らか妹 提交于 2020-01-05 08:18:12
问题 When I try to get attatchment from POP 3 mail, I am getting them as winmail.dat, not the original attached file name. How can I get the original file name? for (int i = 0; i < multipart.getCount(); i++) { BodyPart bodyPart = multipart.getBodyPart(i); if(!Part.ATTACHMENT.equalsIgnoreCase(bodyPart.getDisposition())) { //do something } else { bodyPart.getFileName(); // here only get the winmail.dat } } 回答1: This is part of the Exchange Settings, and sadly you going to need to extract the

Sending an email through struts with java mail API

风格不统一 提交于 2020-01-05 07:23:30
问题 I trying to send a test mail from my struts application. i have a simple jsp page and the action corresponding to that page, i downloaded a simple code to send an email the code is as follows. package java4s; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class

Setting Multipart for email that has attachment

与世无争的帅哥 提交于 2020-01-05 06:58:28
问题 From my application i am send mails that has attachments. the complete code is here public int sendMail(MailDraft mailDraftInstance, mailInstance, path){ //Send the mail String mailSubject = mailDraftInstance.subject String toAddress = mailDraftInstance.toAddress String ccAddress = mailDraftInstance.ccAddress String bccAddress = mailDraftInstance.bccAddress String fromAddress = mailDraftInstance.fromAddress String body = mailDraftInstance.body String smtpUsername = 'myusername' String

Setting Multipart for email that has attachment

て烟熏妆下的殇ゞ 提交于 2020-01-05 06:58:24
问题 From my application i am send mails that has attachments. the complete code is here public int sendMail(MailDraft mailDraftInstance, mailInstance, path){ //Send the mail String mailSubject = mailDraftInstance.subject String toAddress = mailDraftInstance.toAddress String ccAddress = mailDraftInstance.ccAddress String bccAddress = mailDraftInstance.bccAddress String fromAddress = mailDraftInstance.fromAddress String body = mailDraftInstance.body String smtpUsername = 'myusername' String

Track if the email is read by the client

微笑、不失礼 提交于 2020-01-05 01:10:11
问题 I need to track if the email generated by the system is read by the user. For this, I am currently adding an img of 1x1 gif to the email content with src pointing to my hosted web application. In the web application, I have added a servlet filter to track all GET requests. This is working, but for some clients the image is not automatically downloaded, hence I am not able to track the request. Any other alternative/better suggestions? I have seen Ireadit and Spypig. It's not feasible to use

future not working with javax.mail

风流意气都作罢 提交于 2020-01-04 13:40:52
问题 I'm playing with future and and can't seem to get it to work with javax.mail . For example, for fun, I'm trying to set up a compojure handler to grab a bunch of emails and put them into a database, but deliver a response to the client before the emails have all been gathered and inserted. I have a few println s going on in the import-posts function (below), and when I run this from the repl, it works fine, printing 142 journal messages. the first time (because the db is empty), and No new

Altering a multipart/XXX content type without altering the underlying parts

大憨熊 提交于 2020-01-04 08:21:09
问题 I have an instance of MimeMessage which contains encrypted Parts. The original content type is "multipart/encrypted; protocol="application/pgp-encrypted"; boundary="EncryptedBoundary12312345654654" After decryption of each parts, I want the multipart header to change as: "multipart/mixed; boundary="EncryptedBoundary12312345654654" The boundary number is obviously dynamic, then I cannot just make mime.setHeader("Content-Type", "multipart/mixed;" ); Do you have an idea about the best practice

Can not cast IMAPInputStream to Multipart

。_饼干妹妹 提交于 2020-01-04 02:04:49
问题 In Java project, I can receive mails from gmail server. But I want to receive the package part of body. And in this code sample my last message(messages.length - 1) is multipart/mixed. Debug is pass on the if block but it fall into the catch block and gave me this message: Exception in thread "main" java.lang.ClassCastException: com.sun.mail.imap.IMAPInputStream cannot be cast to javax.mail.Multipart How can I handle on this issue? Message[] messages = folder.getMessages(); ArrayList<String>