javamail

Best way to extract a timezone from a mail Date header in Java?

I need to store the timezone an email was sent from. Which is the best way to extract it from the email's 'Date:' header (an RFC822 date)? And what is the recommended format to store it in the database (I'm using hibernate)? ...

How do I send a binary attachment in an email with Java using the JavaMail API?

Using JDK1.5 how does one send a binary attachemnt (such as a PDF file) easily using the JavaMail API? ...

How to send html email to outlook from Java

I'm trying to send an email in html format using JavaMail but it always seems to only display as a text email in Outlook. Here is my code: try { Properties props = System.getProperties(); props.put("mail.smtp.host", mailserver); props.put("mail.smtp.from", fromEmail); props.put("mail.smtp.auth", authentication); p...

Timeouts not working using JavaMail 1.4

I'm using JavaMail to send email requests to an SMTP server. I'm setting both "mail.smtp.connectiontimeout" and "mail.smtp.timeout" properties to 5 and 30 seconds respectively and passing both of these to Session.getDefaultInstance(). However, when I go to do the Transport.send(), the timeouts I set appear to be ignored and it's taking...

Using JavaMail with TLS

I found several other questions on SO regarding the JavaMail API and sending mail through an SMTP server, but none of them discussed using TLS security. I'm trying to use JavaMail to send status updates to myself through my work SMTP mail server, but it requires TLS, and I can't find any examples online of how to use JavaMail to access a...

Creation of a EML file with an attachment using JavaMail

Hi. I'll create a EML file with an attachment using JavaMail. I created a simple EML file successfully, but adding an attachment don't work properly. I'm going to add a PDF file. My EML file will be created successfully. If I open the generated EML file with Outlook I'll find not my PDF file as attachment but I'll find the EML file it...

Doubt in JavaMail program

Hi to all, I have created a java mail program to send mails. It was working fine yesterday.. All the mails were received in inbox folder but today mails are not received in inbox and all the mails are storing in junk box folder. Can anyone know why it happens? and what should i do to receive it in inbox? ...

Spring JavaMailSenderImpl: where to set the charset?

Where do you define the charset a mail is sent with if you are using a Spring JavaMailSenderImpl? We are using the Spring JavaMailSenderImpl with a mail session we get from the Websphere Application Server 6.1. Strangely, the charsets used in sending the emails are different on different systems using the same code. I am looking for a w...

JavaMail Question or Bug?

I have a question about Java Mail and how it works with streams. In Java Mail 1.4.1 there is a MimeMessage constructor that accepts a stream. My understanding is that I could pass a stream to this constructor and it would parse it for me into a MimeMessage. I wrote 2 tests to prove this. The first test sends in a stream that contains...

Hebrew chars in email sent with JavaMail appears as question marks

What can be done? ...

Java mail problem with Turkish characters

I have problem of showing Turkish characters in mail sent with Java code. The characters are shown as question marks (?) in mail. Message msg = new MimeMessage(mailSession); msg.setHeader("Content-Encoding","ISO-8859-9"); msg.setFrom(new InternetAddress(from)); InternetAddress[] address = {new InternetAddress(to)}; msg.setRecipients(Mes...

Problem configuring Spring's MailSender for our SMTP-server (but GMail works)

Hi, I have some problems sending mails through SMTP using Spring's MailSender interface and the concrete implementation JavaMailSenderImpl. I'm able to send mail through GMail, but not through our company SMTP-server (Postfix). Correct configurations To see that I have the correct configuration I used the excellent mail sender ssmtp. I...

Bug Reporting in an Application

I would like a form where users can reports bugs about my application. My initial thought was create a random gmail account hard code information about the account in to the application and mail reports to the account from where i can forward them to my email. using JavaMail. I do not want to maintain a SMTP server just the receive bugs...

Sending mail along with embedded image using javamail

Hi All: I want to send mail along with embedded image. For that i have used the below code. Its not full code. Its a part of code Multipart multipart = new MimeMultipart("related"); // Create the message part BodyPart messageBodyPart; messageBodyPart = new MimeBodyPart(); messageBodyPart.setText(msgBody); // msgbody ...

JavaMail not sending Subject or From under jetty:run-war

Has anyone seen JavaMail not sending proper MimeMessages to an SMTP server, depending on how the JVM in started? At the end of the day, I can't send JavaMail SMTP messages with Subject: or From: fields, and it appears other headers are missing, only when running the app as a war. The web project is built with Maven and I'm testing send...

Mail server for JavaMail testing

Hi. I want to test JavaMail. So i need a Mailserver.. i tested on localhost. So are there any free Mailservers i can use ? ...

Problem with JavaMail and Exchange Server 2007 - BAD Command Argument

Hi, In the application I'm working on, there is a function that connects with a mail server via IMAP using JavaMail. One of our clients had the following stack trace: javax.mail.MessagingException: A13 BAD Command Argument Error. 11; nested exception is: com.sun.mail.iap.BadCommandException: A13 BAD Command Argument Error. 11 at com...

passing java mail message object from between applications

I'm using java mail api 1.4.1 to obtain new emails. Two classes are being used to obtain emails and then parsing it. "GetMail" class communicates with mail server(Gmail,yahoo etc) and obtains the message object. Then the message object is passed to yet another class "MailFormatter" class, which then parses the message object, obtains the...

sharing message object between web applications

I need to share java mail message objects between two web applications(A and B). WebApplication A obtains the message and write it to the outputStream for(int i=0;i<messagesArr.length;i++){ uid = pop3FolderObj.getUID(messagesArr[i]); //storing messages with uid names inorder to maintain uniqueness File f = new File("F:/PersistedMe...

using java mail message object between web applications

I'm developing a web application which acts as an email client for mobile. In this application user can login and provide numerous email ids for monitoring.There are two main classes in the web application. 1.MailGetter 2.MailFormatter Behaviour of MailGetter class: Timertask initiated which will execute for every 10 minutes Obtains t...