javamail

Sending a Spark DataFrame via Email

泪湿孤枕 提交于 2019-12-23 04:00:13
问题 I am working on this project where I need to get the table data in a spark dataframe and send it in a mail. The language to be used is Scala. The dataframe to hold the table data is as follows:- val sqlDfUT = hiveCon.sql("select * from UserTable") I need to send "sqlDfUT" as a message body in a mail. The code for sending the mail is: sendScalaMail("monitor@foo.com","Users Data Sent : \n " + sqlDfUT + ",\nMail sent from host: " + java.net.InetAddress.getLocalHost().getHostName(), "12525","Hive

com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required

你说的曾经没有我的故事 提交于 2019-12-22 15:11:23
问题 I am trying to send an Email from my Java Application to any particular email address. I am using Java Mail API but Unfortunately i am getting SMTPSendFailedException error. Can any body tell me where i am doing a mistake. Here is my code import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; //import SeconMail.Authenticator; public class SendMail { public static void main(String [] args) { // Recipient's email ID needs to be mentioned. String to =

How can I separate business logic and email sending functionality?

让人想犯罪 __ 提交于 2019-12-22 12:44:48
问题 I have a requirement in my java web application where I need to send email alerts for certain conditions. For this I have used javax mail api and sending email works just fine. But the problem is the programs executions waits until the methods for sending the email are executed. As there are hundreds of email to be sent at various points ... this reduces the performance significantly. I am using spring and have also used spring aop. Can anyone suggest me how can I separate my business logic

Receiving email using Imap through SSL connection using javax.mail

倾然丶 夕夏残阳落幕 提交于 2019-12-22 12:28:12
问题 I want to receive emails using imap trough secure connection. I implemented it using using javax.mail api. But there are different server configurations. As I found 1) store = session.getStore(imaps); store.connect(imap.gmail.com, username, password) Which make 'isSSL' true and use port 993 which is secure port to connect in javax.mail. Following configuration also prove secure connection through 993 port. 2) properties.put("mail.imap.host", imap.gmail.com); properties.put("mail.imap.port",

Connect to hotmail with javamail?

一笑奈何 提交于 2019-12-22 12:25:10
问题 I wonder if it is possible to connect to Hotmail with JavaMail? I've tried this but it doesn't work, connection refused... String host = "pop3.live.com"; String username = "laqetqetqet@hotmail.com"; String password = "rqetqetq"; Session session; Store store; String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; Properties pop3Props = new Properties(); pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY); pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");

Connect to hotmail with javamail?

≯℡__Kan透↙ 提交于 2019-12-22 12:24:07
问题 I wonder if it is possible to connect to Hotmail with JavaMail? I've tried this but it doesn't work, connection refused... String host = "pop3.live.com"; String username = "laqetqetqet@hotmail.com"; String password = "rqetqetq"; Session session; Store store; String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; Properties pop3Props = new Properties(); pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY); pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");

Javamail 1.5.1, Tomcat 7, and java.lang.ClassNotFoundException: javax.mail.Authenticator

跟風遠走 提交于 2019-12-22 10:54:49
问题 I trying to use Javamail 1.5.1 with Tomcat 7 and Eclipse Kepler. When I try to send an email, Tomcat blows up with the error below... From the docs, I understand that everything I need is now within the javax.mail.jar. And I have that in the webapp's WEB-INF/lib folder. I think it's complaining that it can't find javax.mail.Authenticator. But I have confirmed that the class is within the jar. This should be easy. Could someone please point out what I am missing? I have also added the jar to

Getting 'message successfully delivered' to the wrong mail address in Java Mail API

こ雲淡風輕ζ 提交于 2019-12-22 10:29:07
问题 I have started implementing a mailing module using the JAVA mail API. Am using the SMTPMessage, so that i can get the delivery status of the mail. Problem is am getting successful delivery report for wrong mail addresses This is what i have done to send the message SMTPMessage smtpMsg=new SMTPMessage(message); smtpMsg.setReturnOption(SMTPMessage.RETURN_HDRS); smtpMsg.setNotifyOptions(SMTPMessage.NOTIFY_SUCCESS |SMTPMessage.NOTIFY_FAILURE); Transport transport = session.getTransport("smtp"); /

How to attach a file to an email using JavaMail

寵の児 提交于 2019-12-22 08:48:33
问题 I need to send a PDF file using JavaMail. The PDF is currently a byte[]. How do I get it into the DataSource? byte[] pdffile = .... messageBodyPart = new MimeBodyPart(); DataSource source = ??? messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(filename); multipart.addBodyPart(messageBodyPart); 回答1: Use javax.mail.util.ByteArrayDataSource: DataSource source = new ByteArrayDataSource(pdffile, "application/pdf"); As you probably know, if the PDF is on the

How do I uniquely identify a Java Mail Message using IMAP?

99封情书 提交于 2019-12-22 06:56:45
问题 IMAP Message in Java Mail is identified by it's relative position number which starts from 1. refer, http://docs.oracle.com/javaee/1.4/api/javax/mail/Message.html#getMessageNumber() Message number is a temporary details. Is there a way to permanently uniquely identify a mail/message which accessing a mailbox via IMAP using Java Mail API which holds true across sessions ? 回答1: Look at the UIDFolder interface, which exposes the IMAP UID capability. 回答2: You can get a unique identifier for a