use com.basis.api.admin.BBjAdminEmailService
use com.basis.api.admin.BBjAdminEmailMessage
use com.basis.api.admin.BBjAdminEmailAttachment
declare BBjAdminBase api!
declare BBjAdminList emailServices!
declare BBjAdminEmailService emailSvc!
declare BBjAdminEmailService selectedEmailSvc!
declare BBjAdminEmailMessage msg!
declare BBjAdminEmailAttachment attachment1!
declare BBjAdminEmailAttachment attachment2!
api!=BBjAdminFactory.getBBjAdmin("admin","admin123")
rem
emailServices! = api!.getEmailServices()
rem
for i=0 to emailServices!.size()-1
emailSvc!=cast(BBjAdminEmailService, emailServices!.get(i))
if emailSvc!.getString(BBjAdminEmailService.NAME)="NombreDeMiEmailService" then correo_seleccionado=i; break endif
next i
selectedEmailSvc!=cast(BBjAdminEmailService, emailServices!.get(correo_seleccionado))
rem
correo:
gosub verifica_correo
test=0
msg!=selectedEmailSvc!.createMessage()
subject$="(TEST) Ejemplo de envio de correo"
msg!.setString(BBjAdminEmailMessage.SUBJECT, subject$)
gosub msghtml
if len(msghtml$)=0 then
msgtext$="Mensaje plano"
msg!.setString(BBjAdminEmailMessage.TEXT, msgtext$)
else
msg!.setString(BBjAdminEmailMessage.HTML, msghtml$)
endif
rem
to$="sua...@gmail.com"
cc$="jjag...@gmail.com"
from$="sua...@gmail.com"
msg!.setString(BBjAdminEmailMessage.TO, to$)
msg!.setString(BBjAdminEmailMessage.FROM, from$)
msg!.setString(BBjAdminEmailMessage.CC, cc$)
rem
rem "ejemplo adjuntar archivo (solo disponible en BBj 20.20)
rem "------------------------
nombre$="nombre_archivo.pdf"
p_attachment1!=new BBjAdminEmailAttachment()
p_attachment1!.setFilename(nombre$)
p_attachment1!.setBytesFromFile(new java.io.File("c:/tmp/archivo.pdf"))
msg!.addAttachment(p_attachment1!)
rem
rem "ejemplo adjunto desde un contenido (solo disponible desde BBj 20.20)
rem "----------------------------------
p_attachment2!=new BBjAdminEmailAttachment()
p_attachment2!.setFilename("nombre_archivo.txt")
p_attachment2!.setBytes("el contenido del txt")
msg!.addAttachment(p_attachment2!)
rem
rem "envio del correo
rem "----------------
selectedEmailSvc!.sendMessage(msg!)
escape
rem
rem
msghtml:
msghtml$=$$
msghtml$=msghtml$+"<html>"
msghtml$=msghtml$+" <head>"
msghtml$=msghtml$+" <style type="+chr(34)+"text/css"+chr(34)+">"
msghtml$=msghtml$+" <!--"
msghtml$=msghtml$+" p { margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; padding-top: 0; padding-right: 0; padding-bottom: 0; padding-left: 0 }"
msghtml$=msghtml$+" -->"
msghtml$=msghtml$+" </style>"
msghtml$=msghtml$+" </head>"
msghtml$=msghtml$+" <body>"
msghtml$=msghtml$+"<!-- ####### THIS IS A COMMENT - Visible only in the source editor #########-->"
msghtml$=msghtml$+"<h1>Envio de DTE Cliente</h1>"
msghtml$=msghtml$+"<h2>Emisor</h2>"
msghtml$=msghtml$+"<p style="+chr(34)+"font-size: 1.5em;"+chr(34)+">"+"razon social emisor"+"</p>"
msghtml$=msghtml$+"<p style="+chr(34)+"font-size: 1.5em;"+chr(34)+">RUT: "+"76.435.200-5"+"</p>"
msghtml$=msghtml$+"<h2>Receptor</h2>"
msghtml$=msghtml$+"<p style="+chr(34)+"font-size: 1.5em;"+chr(34)+">"+"razon social receptor"+"</p>"
msghtml$=msghtml$+"<p style="+chr(34)+"font-size: 1.5em;"+chr(34)+">RUT: "+"96.200.256-5"+"</p>"
msghtml$=msghtml$+"<h2>Detalle</h2>"
msghtml$=msghtml$+"<table border="+chr(34)+"1"+chr(34)+">"
msghtml$=msghtml$+"<tbody>"
msghtml$=msghtml$+"<tr>"
msghtml$=msghtml$+"<td> <strong>Tipo DTE</strong></td>"
msghtml$=msghtml$+"<td> <strong>Folio</strong></td>"
msghtml$=msghtml$+"<td> <strong>Fecha</strong></td>"
msghtml$=msghtml$+"<td> <strong>Monto</strong></td>"
msghtml$=msghtml$+"</tr>"
msghtml$=msghtml$+"<tr>"
msghtml$=msghtml$+"<td> "+"33"+"</td>"
msghtml$=msghtml$+"<td> "+"205022"+"</td>"
msghtml$=msghtml$+"<td> "+"27/12/2020"+"</td>"
msghtml$=msghtml$+"<td> $"+"102.000"+"</td>"
msghtml$=msghtml$+"</tr>"
msghtml$=msghtml$+"</tbody>"
msghtml$=msghtml$+"</table>"
msghtml$=msghtml$+"<p>Este correo adjunta Documentos Tributarios Electrónicos (DTE) para el receptor electrónico indicado. Por favor responda con un acuse de recibo (RespuestaDTE) conforme al modelo de intercambio de Factura Electrónica del SII.</p> </body>"
msghtml$=msghtml$+"</html>"
return
rem
--
Has recibido este mensaje porque estás suscrito al grupo "MundoBBx" de Grupos de Google.
Para cancelar la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a mundobbx+u...@googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/mundobbx/23909689-a62e-4ab5-9362-a3bb86c9b05fn%40googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/mundobbx/CAH6vA8Zt2jdh%3D_aVaGvoMU4zqKQ3Q2us5QbciWx2SUKsBRSZfA%40mail.gmail.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/mundobbx/CAM3qhAoxwjipez9g%3DWoLTEgM%2B9BAT50cLiDfZ39kxruziepJ_Q%40mail.gmail.com.
Has recibido este mensaje porque estás suscrito a un tema del grupo "MundoBBx" de Grupos de Google.
Para cancelar la suscripción a este tema, visita https://groups.google.com/d/topic/mundobbx/Yw5SAyuavBo/unsubscribe.
Para cancelar la suscripción a este grupo y a todos sus temas, envía un correo electrónico a mundobbx+u...@googlegroups.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/mundobbx/CAH6vA8aejBbzwh_TMzp1owJu2KqyD9BfCF%3D01nBsGPTAtENPXQ%40mail.gmail.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/mundobbx/CALYoRC-dKk8uWRXf%3DtX6VZwKCaQbvQJxHdQTog00c6hWxTyBAg%40mail.gmail.com.
Para ver esta conversación en el sitio web, visita https://groups.google.com/d/msgid/mundobbx/CABRg528kwHjPzRd_txDLJXvVzf3PGFajEyt%2Byg2MLJdtxKa5mw%40mail.gmail.com.