javax.mail

Getting error while sending mail in java

对着背影说爱祢 提交于 2019-12-13 07:14:40
问题 I was trying to send mail using java. The code i was using worked when I used it with GMail's SMTP server ("smtp.gmail.com"). But when I changed the code (smtp_host_name, smtp_port properties and authentication UserID/Pwd) to send email through the SMTP server of my ISP provider, this code failed. Here is my code- String host = "smtp server host of my isp provider"; Properties props = System.getProperties(); props.put("mail.smtp.host", host); props.put("mail.debug", "true"); props.put("mail

How to temporarily disable protocol tracing during a JavaMail IMAP connection

爱⌒轻易说出口 提交于 2019-12-13 04:47:30
问题 You can specify whether JavaMail emits a protocol-level trace either when setting the Properties for your Session (by setting the "mail.debug" property to "true" ) or by calling Session.setDebug before you do the store connect. However, when the Protocol object gets instantiated, it creates a "protocol" TraceLogger that persists for the lifetime of the protocol object. Which appears to mean that you can't temporarily disable protocol-level debug logging on a connection once you start using it

Not able to search the email server with searchTerm using Mail API

我的未来我决定 提交于 2019-12-13 02:59:54
问题 An email is sent from lets say gg@gg.com with an attachment to 2 email id's .One, my email id and another xx@xx.com I got that email. When i did mail search using java Mail API with email id as search criteria , it is not able to find it though i received that email.But when i forward it to the same email id's search criteria is working fine. Please let me know when email is received for the first time at that point why it is not able to search Properties properties = System.getProperties();

Getting javax.mail.MessagingException and java.net.SocketException

强颜欢笑 提交于 2019-12-12 06:06:06
问题 I am trying to send a email using SMTP of my yahoo(smtp.mail.yahoo.com) account to my gmail account. But am getting following exception. javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketException: Connection reset at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2153) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1912) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638) at javax

Send mail without Gmail using javax mail

北城余情 提交于 2019-12-12 04:44:59
问题 I'm trying to send an email without Gmail and using javax.mail . In particular, I use two files: mailSender.java and the MainActivity . mailSender.java : package com.polito.gmail; import java.util.Date; import java.util.Properties; import javax.activation.CommandMap; import javax.activation.MailcapCommandMap; import javax.mail.BodyPart; import javax.mail.Multipart; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet

Sign MimeBodyPart which has attachments in it (with Bouncycastle)

妖精的绣舞 提交于 2019-12-11 19:41:25
问题 I am working with OpenAS2Server-1.3.3 library. There sending a single document is working fine.. Now I wanted to modify it to send document with attachments, like we do with emails. In this scenario, all the decription work well, but signature verification failed (MIC is not matched) This is how I am tring to send attachments with main doc: Create a MimeMultipart and add two MimeBodyPart into it. (main document and the attachment) Finally wrap the MimeMultipart within a MimeBodyPart (I am not

Tomcat 6 Javax.mail session envCtx.lookup(“mail/Session”) not returning

谁说胖子不能爱 提交于 2019-12-11 10:59:01
问题 I am using Tomcat 6 to send a email client with Javax.mail APIs , i set up my configurations in server.xml as below <Resource name="mail/Session" auth="Container" type="javax.mail.Session" mail.smtp.host="localhost"/> And in my web.xml as below <resource-ref> <description>Resource reference to a container-managed JNDI JavaMail factory for sending e-mails.</description> <res-ref-name>mail/Session</res-ref-name> <res-type>javax.mail.Session</res-type> <res-auth>Container</res-auth> </resource

Adding attachment to existing MimeMessage

穿精又带淫゛_ 提交于 2019-12-11 07:43:18
问题 I am reading a Mime message like this: InputStream is = new FileInputStream("c:\\Temp\\test.eml"); MimeMessage message = new MimeMessage(session,is); Now i need to simply add an attachment to the existing MimeMessage without changing anything else. How can i do this? I tried: messageBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource("C:\\attachment.pdf"); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName("encrypted_body.pdf"); multipart

Error in Sending mail by Java

邮差的信 提交于 2019-12-10 19:36:07
问题 My code is : // File Name SendEmail.java import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; public class SendEmail { public static void main(String [] args) { // Recipient's email ID needs to be mentioned. String to = "toEmail@gmail.com"; // Sender's email ID needs to be mentioned String from = "fromEmail@gmail.com"; // Assuming you are sending email from localhost String host = "localhost"; // Get system properties Properties properties = System

Java send email avoiding smtp relay server and send directly to MX server

隐身守侯 提交于 2019-12-08 07:06:45
问题 I'm trying to send an email directly to the destination MX server, avoiding the relay smtp server. Teorically it could be possible getting the name servers list doing a query to a dns server. So, using this class, http://www.eyeasme.com/Shayne/MAILHOSTS/mailHostsLookup.html , I can get a list of the mail exchange servers of a domain. So, once I have that, how can I proceed to send the email? I should use javax.mail or how? And if is it, how I should configure it? 回答1: Okay, so suppose we do