sang1285
30th September 2014, 07:46
Hello,
I am trying to send mails from script.
We are maintaining the email ids in a table and sending mails to each user.
The code that I have is working fine for 2-3 mails but if there are more, every now and then it skips one or 2 mails..
below is the code.
can someone help me please?
select tfgei022.*
from tfgei022
where tfgei022._index1 = { :comp }
and tfgei022._compnr = 140
selectdo
|for attachment
shell_cmd = ""
shell_cmd = "uuencode " & filenm & " " & filenm & " > " & mail.attachfile
ret1 = shell(shell_cmd,0)
suspend(1)
|email body
shell_cmd = ""
shell_cmd = "cat " & mail.bodyfile & " " & mail.attachfile & " > " & mail.combinefile
ret1 = shell(shell_cmd,0)
suspend(1)
|mail command
shell_cmd = ""
shell_cmd = "mail -s " & chr$(34) & mail.subject & chr$(34) & " " & strip$(tfgei022.mail) & " < " & mail.combinefile
ret1 = shell(shell_cmd,0)
|ret1 = run.prog(shell_cmd,"",RP_WAIT)
|comd = "/bin/mail"
|args = " -s " & quoted.string(trim$(mail.subject)) & " " & strip$(tfgei022.mail)
|ret1 = run.prog(comd, args, RP_WAIT, trim$(mail.combinefile ))
suspend(10000)
selectempty
message("Distribution list not found. File extracted to " & filenm )
endselect
Thanks a lot in advance,
I am trying to send mails from script.
We are maintaining the email ids in a table and sending mails to each user.
The code that I have is working fine for 2-3 mails but if there are more, every now and then it skips one or 2 mails..
below is the code.
can someone help me please?
select tfgei022.*
from tfgei022
where tfgei022._index1 = { :comp }
and tfgei022._compnr = 140
selectdo
|for attachment
shell_cmd = ""
shell_cmd = "uuencode " & filenm & " " & filenm & " > " & mail.attachfile
ret1 = shell(shell_cmd,0)
suspend(1)
|email body
shell_cmd = ""
shell_cmd = "cat " & mail.bodyfile & " " & mail.attachfile & " > " & mail.combinefile
ret1 = shell(shell_cmd,0)
suspend(1)
|mail command
shell_cmd = ""
shell_cmd = "mail -s " & chr$(34) & mail.subject & chr$(34) & " " & strip$(tfgei022.mail) & " < " & mail.combinefile
ret1 = shell(shell_cmd,0)
|ret1 = run.prog(shell_cmd,"",RP_WAIT)
|comd = "/bin/mail"
|args = " -s " & quoted.string(trim$(mail.subject)) & " " & strip$(tfgei022.mail)
|ret1 = run.prog(comd, args, RP_WAIT, trim$(mail.combinefile ))
suspend(10000)
selectempty
message("Distribution list not found. File extracted to " & filenm )
endselect
Thanks a lot in advance,