17 ObjectPAL: Mail type
VERSIONS: P7

SUBJECT: MAPI addresses

BY: DAVID BERG (BORLAND)

I would expect the most useful interaction between a database and a mail product would be in the address book function, yet I can not find a single Paradox method that deals in this area.

The idea is really quite simple; I wish to send a document from a paradox application and use a list of recipients provided from _inside_ the application. The Mail Type seems to assume that all the recipients a user could need are already in the address book, and that a user is willing to manually select the recipients for every message.

Has anyone discovered a way to automate the selection of a service and address? I've scouted around in the mail API but have found little of help. I'm still hopeing that there is a syntax to directly specify the transport as part of the recipient but I'm not holding my breath.


It's the MAPI service provider that decides how to interpret the address you provide. I assume you're using Exchange, and Microsoft doesn't provide very much information on how Exchange processes addresses; however, it should not require that all addresses be contained in the address book.

For example, I just managed to get it to (try to) fax out a message using "[Fax: 555-1212]" as an addressee name. Unfortunately, the ONLY reference to this form of addressing that I've been able to locate is page 866 of the Windows 95 Resource kit (which has ONLY the example shown above, and no description - in other words, no help at all). However, one might infer from this that a generic format for Exchange may be [Service: Address]. (I'm at home, and can't test a wide variety of services right now, sorry.)

I have also been able to send Internet messages by just specifying the address "BillGATMicrosoft.Com". How well this works may depend on your configuration.

If this doesn't do the job, keep in mind that once an address has been set up in the address book, you can refer to it by it's short name and MAPI will automatically look up the rest of the address (unfortunately, Paradox does not allow you to check to see if an address is in the MAPI address book, but you can call the book separately allowing the user to add names).

Also, if you have a full MS Mail (or other full scale MAPI provider), you may be able to set up a shared address book that all your users would share, and thus store addresses from that book.

Finally, you might check out the Microsoft forums for Win95/Exchange and see if they can tell you how to address the messages (Paradox uses Simple MAPI, so what you need is a form of address that can be passed via Simple MAPI).

P.S. I just thought of something, did a little more experimentation, and discovered a useful trick. Try the following code in a script:
Var 
   Addr, 
   FullAddr String   
   AddrType SmallInt  
   M Mail  
EndVar
M.AddressBookTo("Test")
M.getAddress( 1, Addr, FullAddr, AddrType )
MsgInfo(Addr,FullAddr)
Now, run this and select an address from your address book. The Full Address will be displayed. Put brackets around this and you have an address you can use with AddAddress to directly address the sender. So, for example, what I got back in my test case was "Fax:Nobody@+1 (408)555-1212", and when I do M.AddAddress("[Fax:Nobody@+1 (408)555-1212") it seems to work.

I suppose I should mention that the form of GetAddress above is undocumented and unsupported, but since you'll only be using it to figure out the right format for messages, it shouldn't be a problem.

To index