Doubt about define mail

Doubt about define mail

Postby Wanderson » Thu Feb 03, 2011 1:53 am

Hi,

I want to send email to all array itens:

ato := {}
AAdd(ato,"teste@teste.com.br")
AAdd(ato,"teste1@teste.com.br")

DEFINE MAIL oMail;
SUBJECT "teste";
TEXT "teste";
FROM USER

AADD( oMail:aRecipients, aTo ) // This doesn't work
ACTIVATE MAIL oMail

any idea?
Thanks in advance.
Wanderson.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Doubt about define mail

Postby James Bott » Thu Feb 03, 2011 2:34 am

The simple solution may be:

DEFINE MAIL oMail;
SUBJECT "teste";
TEXT "teste";
TO aTo;
FROM USER

Note that aRecipeints is a two-dimensional array.

oMail:aRecipients[1][1] contains either the name or if 2 is nil, the address
oMail:aRecipients[1][2] contains the address if 1 is not nil

So your aadd() is probably adding both recpients as the first element of the aRecipients array instead of the first two elements of the array.

So you could try:

oMail:aRecipients := aTo

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Doubt about define mail

Postby Wanderson » Thu Feb 03, 2011 2:54 am

James Bott wrote:The simple solution may be:

DEFINE MAIL oMail;
SUBJECT "teste";
TEXT "teste";
TO aTo;
FROM USER

Note that aRecipeints is a two-dimensional array.

oMail:aRecipients[1][1] contains either the name or if 2 is nil, the address
oMail:aRecipients[1][2] contains the address if 1 is not nil

So your aadd() is probably adding both recpients as the first element of the aRecipients array instead of the first two elements of the array.

So you could try:

oMail:aRecipients := aTo

Regards,
James


Hi James, this works:

AADD( aTo, { "teste@hotmail.com" , Nil })
AADD( aTo, { "teste1@hotmail.com", Nil })
AADD( aTo, { "teste2@hotmail.com", Nil })

Thank you. One more question, if i dont use from user the outlook doesn't open and the email goes in next time i execute outlook. If i use from user i dont want to force a user to click in send button, do you know how i can send automatically?

Tia.
Wanderson.
Wanderson
 
Posts: 332
Joined: Thu Nov 17, 2005 9:11 pm

Re: Doubt about define mail

Postby James Bott » Thu Feb 03, 2011 5:27 am

There is no simple answer to this.

The user can configure Outlook to send messages immediately, but this will apply to all messages that they compose. They may not want to do this.

I do not know of any way to send just the messages sent to Outlook from another application immediately.

Alternately, you could send mail directly to a SMTP server and they will go out immediately. The downside is the user may not have a SMTP server or know what it is and how to configure it. Also, they would not have a copy of these in their mail program.

Using Outlook, each person has a copy of the mails they sent in their copy of Outlook. But, nobody else has access to those records. So, ideally the app sending the mails should be keeping a log and copy of all outgoing emails.

No simple answer.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 102 guests