# Enviar email con Outlook y archivo adjunto

**URL:** <https://foros.velneo.com/t/enviar-email-con-outlook-y-archivo-adjunto/7583>\
**Category:** Velneo\
**Created:** [24 Noviembre, 2014 08:41 UTC](https://foros.velneo.com/t/enviar-email-con-outlook-y-archivo-adjunto/7583 "2014-11-24T08:41:36Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![gontorre](https://yyz1.discourse-cdn.com/flex035/user_avatar/foros.velneo.com/gontorre/32/5728_2.png) [@gontorre](https://foros.velneo.com/u/gontorre)\
**Post date:** [24 Noviembre, 2014 13:40 UTC](https://foros.velneo.com/t/enviar-email-con-outlook-y-archivo-adjunto/7583/6 "2014-11-24T13:40:26Z")

</div>

Buenos días,

Estoy intentando hacer un pequeño script para enviar un email al que le paso como parámetros la dirección de email, el asunto y la ruta al archivo adjunto. Como no tengo ni idea de JS estoy bastante perdido. El script es algo así:

function EnviarEmail (diremail, asunto, adjunto) {  
objOutlook = CreateObject(“Outlook.Application”)  
objMailItem = objOutl.CreateItem(0)  
objMailItem.Display  
objMailItem.Recipients.Add(diremail)  
objMailItem.Subject = asunto  
objMailItem.Attachments.Add(adjunto)  
}

Desde un manejador de eventos quiero llamar a esa función y hago lo siguiente:

#include “4e79zgfw.vca/js/EnviarEmail.js”  
asunto=theRoot.varToString(‘ASUNTO’)  
email=theRoot.varToString(‘EMAIL’)  
fichero=theRoot.varToString(‘NOM\_FICHERO’)  
EnviarEmail(email,asunto,fichero)

Al ejecutarlo me da el error:

Error en script: ReferenceError: Can’t find variable: CreateObject \<anonymous\>()@scegestion/VALORACIONES/ENVIAR\_EMAIL\_JS:3

Agradecería mucho algo de ayuda.

Un saludo

Gonzalo Torre

---

_[View the full topic](https://foros.velneo.com/t/enviar-email-con-outlook-y-archivo-adjunto/7583)._
