From: alex@laos (Alex D. Nghiem)
Newsgroups: comp.sys.next.programmer
Subject: messaging mail in 3.0 with distributed objects -- you can't!
Keywords: distributed objects, mail, 3.0
Date: 18 Aug 92 14:34:42 GMT
Reply-To: alex@pencom.com
Organization: Pencom Software

Hello there:

Several weeks ago, I posted a message asking for help on how to message mail  
using remote objects.  This is the only concrete response I got (Thanks,  
William!):

================================================================
Begin forwarded message:

From: William Shipley <wjs@blorf.cpac.washington.edu>
Date: Tue, 18 Aug 92 01:34:22 -0700
To: Alex D. Nghiem <alex@pencom.com>
Subject: Re: sending remote messages to mail in 3.0

Speaker/Listener and Distributed Objects are separate paradigms.  While one  
would hope that everyone using the former would update to the latter, this  
isn't always the case.

Specifically, it appears Mail in 3.0 doesn't implement distributed objects.   
Stupid, yes, but then again there's lots to complain about in Mail.

So, you're stuck using Speaker/Listener, apparently.

-W

=============================================================

For those that are interested, the following code was posted by Andy Stone  
several weeks earlier:

Here's the new, perhaps undocumented, API for Mail:

Mail.msg:

- openSend;
- setTo:(char *)toField;
- setSubject:(char *)subjectField;
- setCc:(char *) ccField;
- setBody:(char *) bodyField;
- deliver;
-openSend:(int *)sender;
-setTo : (char *) toField inWindow:(int)sender;
-setSubject : (char *) subjectField inWindow:(int)sender;
-setCc : (char *) ccField inWindow:(int)sender;
-setBody : (char *) bodyField inWindow:(int)sender;
-deliver:(int)sender;

Note you can now get the id of the newly created window, which will 
prevent the "overwrite of an existing window" bug which everyone was 
alternately blaming Jayson, me, or a dozen others who snarfed that 
undocumented, unpublished hack to send to Mail.
Include Mail.msg in your app, and it will create the MailListener and 
MailSpeaker h and m files.

Here's a sample calling for 3.0PR2 or greater:

- sendMailTo:(const char *)to subject:(const char *)subject body:(const 
char*)body
{
    port_t mail;
    id speaker;
    int theWin;
  

    speaker = [MailSpeaker new];
    mail = NXPortFromName("MailSendDemo", ""); // ACK for now it works
   
    [speaker setSendPort:mail];
    [speaker openSend:&theWin];
    if (subject)[speaker setSubject:(char *)subject inWindow:theWin];
    if (to)[speaker setTo:(char *)to inWindow:theWin];
    if (body)[speaker setBody:(char *)body inWindow:theWin];
    [speaker free];
    return self;
}

			andrew

--
||<<-->>||<<==>>||<<++>>||<<??>>||<<++>>||<<-->>||<<==>>||<<++>>||
!!      Andrew Stone            !!        (505) 345-4800        !!
!!    andrew@stone.com          <>       Stone Design Corp      !!
||<<-->>||<<==>>||<<++>>||<<??>>||<<++>>||<<-->>||<<==>>||<<++>>||



Thanks to both William and Andy for their help.


Best regards,


Alex Duong Nghiem          Phone: (512) 343-1111
Pencom Software            Fax:   (512) 343-9650    
9050 Capital of TX Hwy N.  Mail:  alex@pencom.com
Suite 300                  Mail:  co-Xist_support@pencom.com
Austin, TX 78759           Mail:  co-Xist_info@pencom.com
USA
                           ****************************
                           * NeXTMail gladly accepted *
                           ****************************