FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Doubt about define mail
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
Doubt about define mail
Posted: Thu Feb 03, 2011 01: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.

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Doubt about define mail
Posted: Thu Feb 03, 2011 02: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 332
Joined: Thu Nov 17, 2005 09:11 PM
Re: Doubt about define mail
Posted: Thu Feb 03, 2011 02: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.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Doubt about define mail
Posted: Thu Feb 03, 2011 05: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion