× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Here is what I use:

http://java.sun.com/products/javamail/1.3/docs/javadocs/index.html

There is probably a 1.4 version of the API docs out there somewhere.

Thanx, PLA

Eric Kempter wrote:

Patrick,

Thanks for this (man that was quick) response but how would I have figured this out on my own?

-----Original Message-----
From:   java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]  
On Behalf Of Patrick L Archibald
Sent:   Thursday, May 06, 2004 10:39 AM
To:     Java Programming on and around the iSeries / AS400
Subject:        Re: sendmail

Use the following just like you used: Message.RecipientType.TO

Message.RecipientType.CC

Message.RecipientType.BCC


Thanx, PLA




Eric Kempter wrote:



Newbie question ahead.
I have successfully  implemented JavaMail on our IBM V5R2 iseries (I5/OS).  The 
JavaMail class uses sendmail to send email but I noticed that there is no 
argument for cc or bcc.  I assume that sendmail is a class and contained in a 
package.  My question is, how do I determine what (other) arguments sendmail 
will accept?  How do I determine what package sendmail is included in?  The 
following is the JavaMail source.  Thanks in advance for any assistance.

/*******************************************************************************************
        Date       : 11/02/2001
        Programmer : James Zhang
        Desc       : Practice the javamail.
********************************************************************************************/
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import java.io.*;

public class JavaMailMIME {
public static void main (String args[]) throws Exception {
        
  String from     = args[0];
  String to       = args[1];
  String replyTo  = args[2];
  String subject  = args[3];
  String text     = args[4];
        short returnCode = 0;   
        try{
                returnCode = sendMail(from,to,replyTo,subject,text);    
        }catch(Exception e){
                e.printStackTrace();
        }
}

public static short sendMail (String from, String to, String replyTo, String subject,String text) throws Exception {
try{ //get the properties FileInputStream emailPropertyFile;
//get the properties Properties emailProperty = new Properties();
try{
emailPropertyFile = new FileInputStream("JavaMail.properties");
}catch(FileNotFoundException e){
//JZEmail.properties not found
return 100;
}
emailProperty.load(emailPropertyFile);
emailPropertyFile.close();
//String host = "SMTP.RICAINS.COM"; String hostName = emailProperty.getProperty("email.hostname"); String hostType = emailProperty.getProperty("email.hosttype"); // Get system properties
Properties systemProperty = System.getProperties();

// Setup mail server systemProperty.put(hostType, hostName);

// Get session
Session session = Session.getDefaultInstance(systemProperty, null);
//Session session = Session.getInstance(systemProperty, null); // Define message
MimeMessage message = new MimeMessage(session);

// Set the from address
message.setFrom(new InternetAddress(from));

// Set the to address
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));


                // Set the subject
                message.setSubject(subject);

                // Set the content
                message.setContent(text, "text/html");

// Set the reply to
replyTo = replyTo.trim();
if(replyTo != null && !replyTo.equals("")){
InternetAddress ReplyTo[] = new InternetAddress[1];
ReplyTo[0] = new InternetAddress(replyTo);
message.setReplyTo(ReplyTo);
}

// Send message
Transport.send(message);

}catch(MessagingException me){
// search for the real exception that caused the problem
Exception realException = me;
while ( (realException instanceof MessagingException) && ((MessagingException)realException).getNextException() != null) {
realException = ((MessagingException)realException).getNextException();
}

// map the exceptions to error codes
if (realException instanceof javax.mail.MessagingException) return 101;
else if (realException instanceof java.net.ConnectException) return 102;
else if (realException instanceof java.net.UnknownHostException) return 103;

}catch(Exception e){
// filename is not found
//e.printStackTrace();
return 999;
}
return 0;
}
}


_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) 
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.








_______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.





_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) 
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.






As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.