Page 1 of 1

Email multiple recipients.

PostPosted: Tue May 01, 2007 7:14 pm
by Ollie
Code: Select all  Expand view
cTo:="ollie@theoasis.co.za; support@theoasis.co.za;"
DEFINE MAIL oMail SUBJECT cSubject ;
             TEXT cBody ;
             TO cTo ;
             FROM USER   
ACTIVATE MAIL oMail


This doesn't allow me to send to multiple recipients. How can I do it?

PostPosted: Sun May 06, 2007 8:11 am
by James Bott
Try,

cTo:="ollie@theoasis.co.za, support@theoasis.co.za"

PostPosted: Thu May 24, 2007 9:59 am
by Ollie
Nope.

It puts:

ollie@theoasis.co.za, support@theoasis.co.za

in the email address, but outlook does not recognise it - it thinks its one address.

PostPosted: Thu May 24, 2007 4:05 pm
by James Bott
Ollie,

Try it without the comma.

James

PostPosted: Thu May 24, 2007 4:12 pm
by Ollie
nope.

But I overcame it by using an array: {"bill@ms.com","help@ms.com"}

Thanks for the guidance.

PostPosted: Thu May 24, 2007 6:10 pm
by Ollie
Actually, it didn't work. I used:

oMail:aRecipients := {"ollie@theoasis.co.za","support@theoasis.co.za"}

And it lets me click Send in Outlook (lFromUser = .T.)

but it immediatley reports this message in my Inbox:


Undeliverable:
Your message did not reach some or all of the intended recipients.

Subject: SendEmail Test
Sent: 2007/05/24 20:09

The following recipient(s) could not be reached:

'ollie@theoasis.co.za' on 2007/05/24 20:09
None of your e-mail accounts could send to this recipient.

'support@theoasis.co.za' on 2007/05/24 20:09
None of your e-mail accounts could send to this recipient.


so I'm back where I started - please help.

PostPosted: Thu May 24, 2007 7:00 pm
by James Bott
Ollie,

There seems to be a bug in the MAPI mail.ch include file (ver 7.05 anyway) with the TO clause preprocessing. Instead try it this way. The first address shows up in the TO field and the rest in the CC field.

Note that you need to have a window defined for MAPI to work. Note also that each recipient's address must be in it's own array.

James

Code: Select all  Expand view
// Purpose: test multiple recipients

#include "fivewin.ch"
#include "mail.ch"

function main()
   local oWnd
   define window oWnd
   activate window oWnd on init mailit()
return nil

function mailit()
   local oMail

        define mail oMail ;
           ;//to "jbott@compuserve.com","john@hotmail.com","sharon@hotmail.com" ;
           subject "Test Message";
           from user

        oMail:aRecipients:={{"jbott@compuserve.com"},{"john@hotmail.com"},{"sharon@hotmail.com"}}

         activate mail oMail
return nil

PostPosted: Thu May 24, 2007 7:27 pm
by Ollie
Excellent - Thanks.