javax.mail

javax.mail.AuthenticationFailedException: failed to connect, no password specified?

ぃ、小莉子 提交于 2019-11-27 23:41:08
问题 This program attempts to send e-mail but throws a run time exception: javax.mail.AuthenticationFailedException: failed to connect, no password specified? Why am I getting this exception when I have supplied the correct username and password for authentication? Both the sender and receiver have g-mail accounts. The sender and the receiver both have g-mail accounts. The sender has 2-step verification process disabled. This is the code: import javax.mail.*; import javax.mail.internet.*; import

Send mail in javax.mail without authentication

喜欢而已 提交于 2019-11-27 14:26:37
问题 I am using javax.mail to send mails in Java. Now that a part of the concept of my project changed I have to send a mail without authentication. I will have to change my createSession() method: private void createSession() { properties.put("mail.smtp.auth", "true"); properties.put("mail.smtp.starttls.enable", "true"); properties.put("mail.smtp.host", server); properties.put("mail.smtp.port", port); session = Session.getInstance(properties, new javax.mail.Authenticator() { protected

How to read text inside body of mail using javax.mail

大憨熊 提交于 2019-11-27 11:47:08
i'm developing a client mail using javax.mail to read mail inside mail box: Properties properties = System.getProperties(); properties.setProperty("mail.store.protocol", "imap"); try { Session session = Session.getDefaultInstance(properties, null); Store store = session.getStore("pop3");//create store instance store.connect("pop3.domain.it", "mail.it", "*****"); Folder inbox = store.getFolder("inbox"); FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false); inbox.open(Folder.READ_ONLY);//set access type of Inbox Message messages[] = inbox.search(ft); String mail,sub,bodyText=""; Object

Sending email with attachment through GMailSender?

北战南征 提交于 2019-11-27 05:17:54
I have been reading the blogs and have tried numerous implementations but have still failed to get an image attached to an email that I'm sending through GMail using java. I downloaded all the jars and added GMailSender.java, GMailAuthenticator.java, and JSSEProvider.java and I'm able to send regular e-mails just fine. The way I've tried doing it is shown below, with the middle part that's commented out being the part I had hoped would add the image. Below that is the output on the logcat when I try to execute this. Surely I am missing something pretty simple. Could someone point it out to me

Setting the from name in a javax.mail.MimeMessage?

北慕城南 提交于 2019-11-27 01:27:19
问题 Currently, our application uses a javax.mail to send email, using javax.mail.MailMessage. We set the From headers of the email this way: Message msg = new MimeMessage(mailSession); msg.setFrom(new InternetAddress("mail@companyxyz.com")); This works just fine, but we'd like to make the "From" section a little more user-friendly. Currently, someone receiving an email will see "mail@companyxyz.com" in the "From" section of their inbox. Instead, we'd like them to see "Company XYZ" there. I figure

How to read text inside body of mail using javax.mail

谁都会走 提交于 2019-11-26 15:40:01
问题 i'm developing a client mail using javax.mail to read mail inside mail box: Properties properties = System.getProperties(); properties.setProperty("mail.store.protocol", "imap"); try { Session session = Session.getDefaultInstance(properties, null); Store store = session.getStore("pop3");//create store instance store.connect("pop3.domain.it", "mail.it", "*****"); Folder inbox = store.getFolder("inbox"); FlagTerm ft = new FlagTerm(new Flags(Flags.Flag.SEEN), false); inbox.open(Folder.READ_ONLY)

Sending email with attachment through GMailSender?

柔情痞子 提交于 2019-11-26 12:47:18
问题 I have been reading the blogs and have tried numerous implementations but have still failed to get an image attached to an email that I\'m sending through GMail using java. I downloaded all the jars and added GMailSender.java, GMailAuthenticator.java, and JSSEProvider.java and I\'m able to send regular e-mails just fine. The way I\'ve tried doing it is shown below, with the middle part that\'s commented out being the part I had hoped would add the image. Below that is the output on the logcat