Hi! ,

Weblogic has a Utilities class in the weblogic.remote.common package using
which u can have e-mail capability. This class has a sendMail method by
which
u can send e-mails.

If u are using session beans as a  main entry point in ur middle layer then
u can
have a use case as following which is initiated by the client.
---------------------------------------------
Method in the session bean --->
----------------------------------------------
public String sendMail(String from,  String subject, String body) throws
ProcessingErrorException
  {
    ParamSet ps = new ParamSet();
    try
    {
       ps.setParam("smtphost", SMTP_SERVER);// defined static final String
in ur session bean
       ps.setParam("from", from);
       ps.setParam("to", TO_ADDRESS); // defined static final String in ur
session bean
       ps.setParam("subject", subject);
       ps.setParam("body", body);
      T3ServletDef t3serv =
t3Client.services.remote().getT3Servlet(MAIL_SERVELET_CLASS_NAME); //
Mailer.java
      t3serv.execute(ps);
      return ps.getParam("status").asString();
   }
  catch(Exception e)
  {
      throw new ProcessingErrorException(e.getMessage());
  }
}

The client invokes this method passing the  from,  subject and  body
parameters.
This method would in turn  executes a T3Servlet that sends the mail.

--------------------------------------
Mailer T3Servlet code ( Mailer.java) ----->
-------------------------------------
import weblogic.common.*;
import weblogic.remote.common.*;

/**
 * This T3Servlet allows a client to send an email message. All
 * the work is done by Tengah; the client just enters the particulars
 * of the message as a set of parameters that are used by the T3Servlet
 * when Tengah executes it.
 *
 */
public class Mailer implements T3ServletDef
{

  T3ServicesDef services;

  /**
   * Sets the services object.
   */
  public void setServices(T3ServicesDef services) {
    this.services = services;
  }

  /**
   * Declares parameters that must be fulfilled by
   * the client that calls the execute method. Tengah
   * calls this method when the T3Servlet is instantiated.
   */
  public void declareParams(ParamSet ps) throws ParamSetException {
    // Declare parameters for information we will need from
    // the user to execute this procedure.
    ps.declareParam("smtphost", ParamTypes.STRING, "SMTP server address");
    ps.declareParam("from",     ParamTypes.STRING, "Sender email");
    ps.declareParam("to",       ParamTypes.STRING, "Recipient email");
    ps.declareParam("subject",  ParamTypes.STRING, "Subject");
    ps.declareParam("body",     ParamTypes.STRING, "Body text");
    ps.declareParam("status",   ParamTypes.STRING, "Status message");
  }

  /**
   * Here is the work. Write the task in the <tt>execute()</tt>
   * method that should be carried out when the T3Client calls the
   * <tt>execute()</tt> method on a T3Servlet object.
   */
  public void execute(ParamSet ps)  throws ParamSetException
{
    try
{
      String smtphost = ps.getParam("smtphost").asString();
      String from     = ps.getParam("from").asString();
      String to       = ps.getParam("to").asString();
      String subject  = ps.getParam("subject").asString();
      String body     = ps.getParam("body").asString();
      Utilities.sendMail(smtphost,  from,  to,  subject,  body);
      ps.setParam("status", "Success! Message sent.");
    }
    catch (Exception e) {
      ps.setParam("status", "Sorry! Failure: " + e);
    }
  }
 }


I guess it should satisfy ur requirements.......

Cheers!!
Shiraz


-----Original Message-----
From: Andrew J. Roehr <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Wednesday, March 17, 1999 4:32 PM
Subject: Email Integration


>Apologies,  a little off topic.  We are building an EJB-based application
>set, and one of the elements of the application is an email client.  We are
>looking for something that has already been written which we can use.  Now,
>this can even be a servelet that dishes HTML.  I am looking for pointers to
>something that will allow us to NOT write code and plug the service into
our
>environment (BEA/Weblogic).  Most of what I am seeing is "jave clients" and
>we need a thin client implmentation.
>
>Any help is appreciated.
>
>Andy
>
>Andrew J. Roehr
>
>Chief Technology Officer
>Agillion, Inc.
>
>7600-B N. Capital of Texas Hwy.
>Suite 220
>Austin, TX.  78731
>
>(p) (512) 682-8002
>(f) (512) 306-7331
>
>[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>===========================================================================
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff EJB-INTEREST".  For general help, send email to
>[EMAIL PROTECTED] and include in the body of the message "help".
>
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to