RE: Email Problem in WebObjects
RE: Email Problem in WebObjects
- Subject: RE: Email Problem in WebObjects
- From: "Ganesh Kumar D" <email@hidden>
- Date: Thu, 16 Mar 2006 19:29:50 +0530
- Importance: Normal
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@hidden]
Sent: Friday, March 10, 2006 7:04 PM
To: email@hidden
Cc: email@hidden
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden