Genetating an array of cc addresses to Pass thru Tsmtp

Genetating an array of cc addresses to Pass thru Tsmtp

Postby Rick Lipkin » Sun Aug 17, 2008 11:18 pm

To All

I am trying to build a single array of e-mail addresses and then pass that array to tsmtp ( smtp e-mail) ..

Here is the basic code :

go thru a loop to get e-mail addresses :

aCC := {}

oRsSpon:MoveFirst()
DO WHILE .not. oRsSpon:eof

AADD( aCC, {alltrim(oRsSpon:Fields("sponsorid"):Value)+"@"+alltrim(oRsSpon:Fields("domain"):Value)} )

oRsSpon:MoveNext()

ENDDO


Then pass this array to the SMTP Class :

oWndMdi:SetMsg( "Sending Reporting noticication to "+cTO )

WSAStartup()
oOutMail := TSmtp():New( cIP := GetHostByName( cHOST ) )

oOutMail:bConnecting = { || oWndMdi:SetMsg( "Connecting to "+cHOST ) }
oOutMail:bConnected = { || oWndMdi:SetMsg( "Connected" ) }
oOutMail:bDone = { || oWndMdi:SetMsg( "Message sent successfully" ) }

oOutMail:SendMail( cFROM,; // From
{ cTO },; // To
cMESSAGE,; // Msg Text
cSUBJECT,;
{"C:\DBTMP\PROJINFO.BAT"},; // attachment
aCC, ; // cc array <-- BLOWS HERE
{ }, ; // bc
.F., ; // no return receipt
NIL ) // not html


I know everything is correct .. if I use {} for the cc section the e-mail is sent . .something about creating and passing the array is wrong. Here is what the cc array should look like :

{"rick@email.com", "rick1@email.com", "rick2@email.com"}

Any suggestions ??

Rick Lipkin
SC Dept of Health, USA
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby Colin Haig » Mon Aug 18, 2008 3:59 am

Rick

Why the array in the add
*
AADD( aCC, {alltrim(oRsSpon:Fields("sponsorid"):Value)+"@"+alltrim(oRsSpon:Fields("domain"):Value)} )
*

AADD( aCC, alltrim(oRsSpon:Fields("sponsorid"):Value)+"@"+alltrim(oRsSpon:Fields("domain"):Value) )

Regards

Colin
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Postby Rick Lipkin » Mon Aug 18, 2008 12:28 pm

Colin

I will try it .. guess I have been looking at this code too long ..

Rick
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests