• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Email Problem in WebObjects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Email Problem in WebObjects


  • Subject: Re: Email Problem in WebObjects
  • From: Pascal Robert <email@hidden>
  • Date: Fri, 10 Mar 2006 08:33:52 -0500

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
  • Follow-Ups:
    • RE: Email Problem in WebObjects
      • From: "Ganesh Kumar D" <email@hidden>
    • Yet another OD/LDAP question
      • From: Timmy <email@hidden>
References: 
 >Email Problem in WebObjects (From: "DGanesh" <email@hidden>)

  • Prev by Date: Email Problem in WebObjects
  • Next by Date: Yet another OD/LDAP question
  • Previous by thread: Email Problem in WebObjects
  • Next by thread: Yet another OD/LDAP question
  • Index(es):
    • Date
    • Thread