PDA

Ver la Versión Completa : [Duda] Envio de e-mail con adjuntos


Gusaiello
20 de noviembre de 2019, 15:57
Hola a todos.
Estoy usando AcuCobol GT 5.1 para Windows.
A través de un programa puedo llamar al cliente de correo pasandole la dirección del destinatario.

STRING "MAILTO:"
E-MAIL-CLI
DELIMITED BY SIZE INTO MAIL
display web-browser value MAIL

Donde E-MAIL-CLI es el campo del archivo de clientes donde guardo la dirección y MAIL es la variable que le paso a web-browser.

Quisiera saber si es posible a la vez que se le indica la dirección del destinatario, adjuntarle un archivo.

Revisé toda la documentación y no encontré nada.

Alguno sabe si es posible?.

Desde ya muchas gracias de antemano.

Kuk
20 de noviembre de 2019, 16:09
Gusaiello, mira a ver si te sirve esto: vbscript - creating a vbs script function for sending email with attachment - Stack Overflow (https://stackoverflow.com/questions/35661285/creating-a-vbs-script-function-for-sending-email-with-attachment)

Habrá que crear un fichero *.vbs y ejecutarlo desde tu programa.

Joseg
20 de noviembre de 2019, 17:45
Eu uso SwithMail:


string "SwithMail.exe /s /x swc.xml" delimited by size
" /to " delimited by size *> para
JH-TO delimited by " "
into CommandLine
end-string

IF JH-CC NOT = SPACES
STRING CommandLine DELIMITED BY " " *> CC
" /CC " delimited by size
JH-CC delimited by " "
INTO CommandLine
end-string
END-IF

STRING CommandLine DELIMITED BY " "
' /sub "' delimited by size
JH-SUBJECT delimited by " " *> assunto
'"' delimited by size
INTO CommandLine
end-string

STRING CommandLine DELIMITED BY " "
' /b ' delimited by size *> body
'"' delimited by size
JH-BODY delimited by " "
'"' delimited by size
into CommandLine
end-string

IF JH-ATTACH NOT = SPACES
STRING CommandLine DELIMITED BY " "
' /a ' delimited by size
'"' delimited by size
JH-ATTACH DELIMITED BY " " *> anexo1
'"' delimited by size
INTO CommandLine
end-string
END-IF

---> chamar aqui a CommandLine (não sei como é em Acucobol)




Usando o Outlook:
Criar um arquivo line sequencial:


move spaces to regsm
MOVE "Dim o" to regsm
WRITE regsm
*-----------------------------------------------------------------------------
move spaces to regsm
MOVE "Dim m" to regsm
WRITE regsm
*-----------------------------------------------------------------------------
move spaces to regsm
MOVE 'Set o = CreateObject("Outlook.Application")' to regsm
WRITE regsm
*-----------------------------------------------------------------------------
move spaces to regsm
MOVE 'Set m = o.CreateItem(0)' to regsm
WRITE regsm
*-----------------------------------------------------------------------------
move spaces to regsm
STRING "m.to = " DELIMITED BY SIZE
'"' DELIMITED BY SIZE
pmail DELIMITED BY ' ' *> EMAIL
'"' DELIMITED BY SIZE
INTO regsm
WRITE regsm
*-----------------------------------------------------------------------------
move spaces to regsm
MOVE spaces TO pcc *> CC
IF pcc NOT = " "
STRING "m.Cc = " DELIMITED BY SIZE
'"' DELIMITED BY SIZE
pcc DELIMITED BY ' '
'"' DELIMITED BY SIZE
INTO regsm
WRITE regsm
END-IF
*-----------------------------------------------------------------------------
move spaces to regsm
MOVE spaces TO pbcc *> BCC
IF pbcc NOT = " "
STRING "m.Bcc = " DELIMITED BY SIZE
'"' DELIMITED BY SIZE
pbcc DELIMITED BY ' '
'"' DELIMITED BY SIZE
INTO regsm
WRITE regsm
END-IF
*-----------------------------------------------------------------------------
move spaces to regsm
STRING "m.Subject = " DELIMITED BY SIZE
'"' DELIMITED BY SIZE
passunto DELIMITED BY ' ' *> assunto
'"' DELIMITED BY SIZE
INTO regsm
WRITE regsm
*-----------------------------------------------------------------------------
move spaces to regsm
MOVE "m.Display" to regsm
WRITE regsm

*-----------------------------------------------------------------------------

move spaces to regsm

STRING "m.HTMLBody = " DELIMITED BY SIZE
'"' DELIMITED BY SIZE
pbody DELIMITED BY ' ' *> body
'" & "<br>" & m.HTMLBody ' DELIMITED BY SIZE
INTO regsm
WRITE regsm
*-----------------------------------------------------------------------------
move spaces to regsm
*> Attachments
STRING "m.Attachments.Add " DELIMITED BY SIZE
'"' DELIMITED BY SIZE
pAttachments DELIMITED BY ' ' *> anexos
'"' DELIMITED BY SIZE
INTO regsm
WRITE regsm
*-----------------------------------------------------------------------------
move spaces to regsm
MOVE "m.Display" to regsm
WRITE regsm

*-----------------------------------------------------------------------------
move spaces to regsm
MOVE "m.Send" TO regsm
WRITE regsm