aspose file tools*
The moose likes Java in General and the fly likes Blank Email Notification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Blank Email Notification" Watch "Blank Email Notification" New topic
Author

Blank Email Notification

Krish Vasu
Greenhorn

Joined: Sep 06, 2005
Posts: 4
Hi All,

In our application we are sending out a Email Notification to the customer using java.

Most of the customer are getting the notification properly. Few of the users are complaining that tehey are receiving the Email with blank body, but the mail has the proper subject.

What could be the cause of this.

Thanks in advance for your suggestion on the above issue.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Originally posted by Krish Vasu:

What could be the cause of this.


The exact cause depends on how you're sending the mail, of course: JavaMail, a shell script, hand-written SMTP client code, etc. You'll have to give us a few details before we can help you.


[Jess in Action][AskingGoodQuestions]
Mahesh Rana
Ranch Hand

Joined: Sep 05, 2001
Posts: 139
If you are sending HTML / RTF mails, it will definitly confuse older versions of some email clients ( e.g PINE 4.21, not 100% sure though).
It just downloads the body as an attachment named "Unknown" or "email.dat".

Another common problem behind "Empty Body" for Text based email clients is not understanding the charset.


SCJP2
Krish Vasu
Greenhorn

Joined: Sep 06, 2005
Posts: 4
Hi,

Thanks for the update.

We are sending the email content in the text format by writing to a Socket.

What should be ideal charset the client needs to configure in their email client.

I have been informed by the user that they are using Lotus Notes as their emial client.

Pls, advice. Thanks...
Vikas Bhatia
Greenhorn

Joined: Mar 22, 2005
Posts: 17
Originally posted by Krish Vasu:
Hi,

Thanks for the update.

We are sending the email content in the text format by writing to a Socket.

What should be ideal charset the client needs to configure in their email client.

I have been informed by the user that they are using Lotus Notes as their emial client.

Pls, advice. Thanks...


Bad idea!!!

Socket connections, although appear to work in a standard way, are notorious when it comes to SMTP server side implementation. For example, not long ago we had a situation, where if the application was sending email via Sendmail server, by doing socket communication on port 25, the body of the email disappeared, but the same code when it ran against Domino mail server ran fine!!!

turned out, that the exact format that u need to send the SMTP commands varies with the SMTP implementation:

for sendmail it is
helo
mail from:
rctp to:

data

subject:

<actual body>

.

With domino, it was
helo
mail from:
rctp to:


data


subject:


<actual body>
.

The number of CR-LF that you put between SMTP commands is different!!!

I would suggest that you resort to using Java mail api as it will take care of all the various permutation/combinations that exist for various SMTP implementations, not to mention it keeps the code clean
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Vikas, this explanation about the number of line feeds is bogus; such a server couldn't function on the heterogeneous Internet. Much more likely, the problem you saw was caused by a failure to flush the data (using "flush()") you were sending to the socket at the appropriate times. The extra newlines may have triggered automatic flushing at just the right moments.

So Krish, be sure to flush the commands and data you send, and be sure the read the replies from the server and do something with them: ideally, parse out the result codes and report or respond to errors.

Rather than using a socket, you might consider using the JavaMail API, which would do all of this for you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Blank Email Notification