• 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: send component as email
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: send component as email


  • Subject: Re: send component as email
  • From: Denis Stanton <email@hidden>
  • Date: Thu, 5 Feb 2004 09:26:37 +1300

Hi Anonymous (have you no name? Calling yourself "webobjects" in your email address is confusing)

Here is a cut-down version of a module I use to send an invoice by email.

This Component is called SendInvoice. It creates an instance of another component named Invoice and emails it when the user clicks a button.
The HTML page for the SendInvoice component embeds a copy of Invoice and a button linked to the "sendMail" action below.


Denis

//
// Created by denis on Tue Sep 23 2003
//

import com.webobjects.foundation.*;
import com.webobjects.appserver.*;
import com.webobjects.eocontrol.*;
import com.webobjects.eoaccess.*;

public class SendInvoice {

    public HireInvoice(WOContext context) {
        super(context);
    }

    public WOComponent sendEmail() {
        String from = "email@hidden";
        NSArray to = new NSArray("email@hidden);
        NSArray cc = new NSArray("email@hidden");

        // Invoice is a WOComponent
        Invoice invoice = (Invoice)pageWithName("Invoice");

WOMailDelivery.sharedInstance().composeComponentEmail(from, to, cc, "Invoice from My Company for " + "Customer Name", invoice, true);
return null;
}


}


On Thursday, February 5, 2004, at 02:40 AM, WebObjects EMail wrote:

hello,
i just try to create a component to send it per Email how can i do that?


i created a simple java class and call it in the Application constroctor like
that



public Application() {

super();

robotSMail r = new robotSMail();

}

public class robotSMail {

        public robotSMail()

        {

                MessageBody body = new  MessageBody();

WOMailDelivery mailAgent = WOMailDelivery.sharedInstance();

System.out.println("\n\n\nread : "+mailAgent.toString() );

                mailAgent.composeComponentEmail

                (

                       "email@hidden",

                       new NSArray(new String[]
{"email@hidden"} ),

                       null,

                       "Subject",

                       body,

                       true

                );

        }

}

MessageBody class is a WOComponent.
if i use MessageBody() i get Error The constructor MessageBody() is
undefined.
i dont need any session, context, etc..

thenks for help.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.



Denis Stanton
email@hidden
Home:  +64 9 533 0391
mobile: +64 21 1433622
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >send component as email (From: "WebObjects EMail" <email@hidden>)

  • Prev by Date: Re: about session time out
  • Next by Date: Re: Generating URL dynamically
  • Previous by thread: Re: send component as email
  • Next by thread: Making good EOs
  • Index(es):
    • Date
    • Thread