Hi Robert,

                Thanks for your reply. I found the solution. Actually the 
problem is with
Subject. I added a new line character at the end of the subject.

Thanks,
Ganesh


-----Original Message-----
From: Pascal Robert [mailto:[EMAIL PROTECTED]
Sent: Friday, March 10, 2006 7:04 PM
To: [EMAIL PROTECTED]
Cc: [email protected]
Subject: Re: Email Problem in WebObjects


1) you don't seem to need to construct a MimeMessage, this class is
needed only when your email has multiple part (text + html, text with
attachments, etc.), use Message instead

2) you need to replace this :

>       prop.put("mail.smtp.host",host);

with a real SMTP server instead of « mail.smtp.host »

3) Do a system.out.println of the emailBody variable, I'm pretty sure
that you are adding headers in there...

> Hi folks,
>
>       I am using java mail api to send emails from WebObjects application.
> But I am facing a small problem. The headers are getting displayed in
> emails' body. for example here is the mail's body received by the
> recipient
> when I send it from application.
>
> Mime-Version: 1.0
> Content-Type: text/html
> Content-Transfer-Encoding: 7bit
>
> Event Due Date:2006-03-10 18:29:58 Etc/GMT
> Event Date: null
> Priority : High
> Event Time :null
>
>
>       When I tried the same code from simple java file Independent of
> WebObjects) the recipient is receiving the mails properly as shown
> below...
>
> Event Due Date:2006-03-10 18:29:58 Etc/GMT
> Event Date: null
> Priority : High
> Event Time :null
>
>
>
> here is the code I am using to send emails
>
>       Properties prop =System.getProperties();
>       prop.put("mail.smtp.host",host);
>       prop.put("mail.debug", "true");
>       javax.mail.Session ses1  =
> javax.mail.Session.getDefaultInstance(prop,null);
>       MimeMessage message= new MimeMessage(ses1);
>       message.setFrom(new InternetAddress(cv_fromAddress));
>       message.addRecipient(Message.RecipientType.TO,new
> InternetAddress(email));
>       message.setSubject(subject);
>       message.setText(emailBody);
>       Transport.send(message);
>
>
> is there any thing I am doing wrong?
>
> Thanks in advance,
> Ganesh.


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to