• 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
JavaMail help...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JavaMail help...


  • Subject: JavaMail help...
  • From: LD <email@hidden>
  • Date: Sat, 9 Jul 2005 18:07:16 +1000

Hi there,

I've just downloaded JavaMail-1.3.2 and JAF-1.0.2 from Sun and am attempting to send a simple email from my WOApp (quite a hassle for something that WOMailDelivery should be able to handle for simple stuff)...

Anyway, I've placed them as...
/Library/Java/Extensions/activation.jar
/Library/Java/Extensions/javamail-1.3.2/

And in Xcode I've adjusted JAVA_COMPILER_FLAGS = -extdirs /Library/ WebObjects/Extensions:/Library/Java/Extensions:/System/Library/Java/ Extensions:/System/Library/Frameworks/JavaVM.framework/Home/lib/ext:/ Library/Java/Extensions/javamail-1.3.2

Any better ideas on that would be good to know...
In DirectAction.java I've got an action "sendFeedbackAction" which constructs an email from the supplied fields and _attempts_ to send the email off to staff. But I'm getting the following error...


com.webobjects.foundation.NSForwardException for java.lang.NoClassDefFoundError: javax/mail/Address
at DirectAction.sendFeedbackAction(DirectAction.java:73)


Here's a portion of the code from DirectAction.java
    String sender;
    NSArray somePeople;
    NSArray otherPeople;
    String subject;
    StringBuffer message;
    <...>

try {
LDMailDelivery.deliverPlainTextEmail(sender, somePeople, otherPeople, subject, message.toString()); // line 73
} catch (Exception e) {
System.err.println("Mail Delivery Error: " + e.getMessage());
e.printStackTrace();
}


And below is the LDMailDelivery.java class

Any ideas why it's giving me this error? Thanks.

with regards,
--

LD

import com.webobjects.foundation.*;
import com.webobjects.eocontrol.*;
import com.webobjects.appserver.*;
import java.io.*;
import java.util.*;
import java.util.regex.*;
import java.net.InetAddress;
import javax.mail.*;
import javax.mail.internet.*;

public class LDMailDelivery {

    private final static boolean DEBUG = false;
    private final static String RecipientsSeparator = ", ";

    private LDMailDelivery() { }

    public static String SMTPHost() {
        return WOApplication.application().SMTPHost();
    }

public static String SMTPAgent() {
return NSProperties.getProperty("SMTPAgent", "LDWOMailer (0.1)");
}


public static void deliverComponentEmail(String aSender, NSArray somePeople, NSArray otherPeople, String aSubject, WOComponent aComponent) {
System.err.println("deliverComponentEmail is not implemented yet!");
}


public static void deliverPlainTextEmail(String aSender, NSArray somePeople, NSArray otherPeople, String aSubject, String aMessage)
throws
java.lang.IllegalStateException,
javax.mail.IllegalWriteException,
javax.mail.MessagingException,
javax.mail.internet.AddressException,
javax.mail.SendFailedException,
javax.mail.MessagingException
{
javax.mail.Message email;


email = createMessage(aSender, somePeople, otherPeople, aSubject);
email.setText(aMessage);
sendEmail(email);
}


private static void sendEmail(javax.mail.Message message)
throws javax.mail.SendFailedException, javax.mail.MessagingException
{
javax.mail.Transport.send(message);
}


private static javax.mail.Message createMessage(String aSender, NSArray somePeople, NSArray otherPeople, String aSubject)
throws
java.lang.IllegalStateException,
javax.mail.IllegalWriteException,
javax.mail.MessagingException,
javax.mail.internet.AddressException
{
java.util.Properties properties;
javax.mail.Session session;
javax.mail.internet.MimeMessage message;
java.util.Enumeration en;
String aPerson;


        properties = System.getProperties();
        properties.put("mail.smtp.host", SMTPHost());

        session = javax.mail.Session.getInstance(properties);
        session.setDebug(DEBUG);

message = new javax.mail.internet.MimeMessage(session);
if (aSender == null) {
message.setFrom();
} else {
message.setFrom(new InternetAddress(aSender));
}
// message recipients: TO, CC
message.setRecipients(Message.RecipientType.TO, somePeople.componentsJoinedByString(RecipientsSeparator));
if (otherPeople != null && otherPeople.count() != 0) {
message.setRecipients(Message.RecipientType.CC, otherPeople.componentsJoinedByString(RecipientsSeparator));
}
message.setSubject(aSubject);
message.setHeader("X-Mailer", SMTPAgent());
message.setSentDate(new Date());


        return message;
    }

}

_______________________________________________
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: JavaMail help...
      • From: Pascal Robert <email@hidden>
  • Prev by Date: Old WOBuilder Lives!
  • Next by Date: Followup: Correct character sets settings with mysql 4.1.10?
  • Previous by thread: Re: Old WOBuilder Lives!
  • Next by thread: Re: JavaMail help...
  • Index(es):
    • Date
    • Thread