command mfg2mail

is mfg2mail something you want to create from scratch or modification of some existing functionality ?
 
We attach the script to his, is running every Monday and sent an e-mail, the problem silk adds that the result as the body of the mail and not as an attachment

DEF VAR comanda AS CHAR.
OUTPUT TO "/extr/cxc_comercial1".
put "Factura;Cuenta;Monto;Monto Aplicado;Rut;Nombre;Moneda;Fecha;Fecha de Ven;"
SKIP.
FOR EACH ar_mstr WHERE ar_domain = '20' and ar_amt <> ar_applied:
FIND FIRST cm_mstr WHERE cm_domain = '20' AND cm_addr = ar_bill NO-ERROR.



IF AVAIL cm_mstr THEN DO:
export delimiter ";"

ar_nbr
ar_acct
ar_amt
ar_applied
ar_bill
cm_sort
ar_curr
ar_date
ar_due_date.
END.
END.

OUTPUT Close.
OUTPUT TO "/extr/cxc_comercial2".
put "Factura;Cuenta;Monto;Monto Aplicado;Rut;Nombre;Moneda;Fecha;Fecha de Ven;"
SKIP.
FOR EACH ar_mstr WHERE ar_domain = '10' and ar_amt <> ar_applied:
FIND FIRST cm_mstr WHERE cm_domain = '10' AND cm_addr = ar_bill NO-ERROR.



IF AVAIL cm_mstr THEN DO:
export delimiter ";"

ar_nbr
ar_acct
ar_amt
ar_applied
ar_bill
cm_sort
ar_curr
ar_date
ar_due_date.
END.
END.

OUTPUT Close.
FOR EACH code_mstr WHERE code_fldname = 'mail_cuentasxcobrar' and code_domain = '10':

comanda = "mfg2mail" + " " + "'Cuentas por Cobrar1'" + " " + "'/extr/cxc_comercial.txt'" + " " + "'admin@xxxxx.xxx'" + " " + code_cmmt.
OS-COMMAND VALUE(comanda).
END.
FOR EACH code_mstr WHERE code_fldname = 'mail_cuentasxcobrar' and code_domain = '10':

comanda = "mfg2mail" + " " + "'Cuentas por Cobrar2'" + " " + "'/extr/cxc_comercial2.txt'" + " " + "'admin@xxxx.xx'" + " " + code_cmmt.
OS-COMMAND VALUE(comanda).
END.

Thanks
 
You could use mailx (I think it's mail under Linux), the Unix version goes something like this:

Code:
DEF VAR oscommand AS CHAR NO-UNDO.
ASSIGN oscommand = 
  "uuencode " + cMessageFile + " |mail -s 'Subject' person@address.com".
 
OS-COMMAND SILENT VALUE (oscommand).

You can script it as well. I don't know Linux that well, but this should work under Unix and probably Linux:

mailme.sh:
Code:
uuencode $1 |mail -s "$2" $3

mailme.sh /usr/data/myfile.txt "My File Email" me@mycompany.com

You can set it to have more than one attachment and also have a message in the body of the email, but I don't have that code to hand at the moment.
 
Back
Top