en es el codigo del boton ENVIAR CORREO
Dim Documento As New Word.Application
''''''''''''''''''''''''''''
email1 = ""
email2 = ""
email3 = ""
If adoConsulta.Recordset.EOF Then
MsgBox "Seleccione un comprobante para ver"
Exit Sub
Else
tipoComprobante = adoConsulta.Recordset("tipocomprobante")
cod_comprobante = adoConsulta.Recordset("cod_comprobante")
End If
rsClientex.Open "select * from CLIENTES where razon='" & adoConsulta.Recordset("razon") & "'", cn, adOpenStatic, adLockOptimistic
email1 = IIf(IsNull(rsClientex("correo1")), "", rsClientex("correo1"))
email2 = IIf(IsNull(rsClientex("correo2")), "", rsClientex("correo2"))
email3 = IIf(IsNull(rsClientex("correo3")), "", rsClientex("correo3"))
rsClientex.Close
Set rsClientex = Nothing
If email1 <> "" Then
With Documento
'.Application.Documents.Open App.Path & "\presupuestos\presupuesto.doc"
.Application.Documents.Add App.Path & "\plantillahosting\datoshosting.dot"
.ActiveDocument.Bookmarks.Item("cliente").Range.Text = Trim(adoConsulta.Recordset("razon"))
.ActiveDocument.Bookmarks.Item("dominio").Range.Text = "www." & Trim(adoConsulta.Recordset("identificador"))
.ActiveDocument.Bookmarks.Item("cpanel").Range.Text = "http://www." & Trim(adoConsulta.Recordset("identificador")) & "/cpanel"
.ActiveDocument.Bookmarks.Item("login").Range.Text = Trim(adoConsulta.Recordset("login"))
.ActiveDocument.Bookmarks.Item("password").Range.Text = Trim(adoConsulta.Recordset("password"))
.ActiveDocument.Bookmarks.Item("webmail").Range.Text = "http://www." & Trim(adoConsulta.Recordset("identificador")) & "/webmail"
.ActiveDocument.Bookmarks.Item("ftp").Range.Text = "ftp." & Trim(adoConsulta.Recordset("identificador"))
.ActiveDocument.Bookmarks.Item("loginftp").Range.Text = Trim(adoConsulta.Recordset("login"))
.ActiveDocument.Bookmarks.Item("passwordftp").Range.Text = Trim(adoConsulta.Recordset("password"))
.ActiveDocument.Bookmarks.Item("email").Range.Text = Trim(adoConsulta.Recordset("identificador"))
.ActiveDocument.Bookmarks.Item("email2").Range.Text = Trim(adoConsulta.Recordset("identificador"))
.ActiveDocument.Bookmarks.Item("pop3").Range.Text = Trim(adoConsulta.Recordset("identificador"))
.ActiveDocument.Bookmarks.Item("smtp").Range.Text = Trim(adoConsulta.Recordset("identificador"))
.ActiveDocument.Bookmarks.Item("vendedor").Range.Text = correousuario
'muestra el documento
.ChangeFileOpenDirectory App.Path & "/datosHosting/"
nomArchivo = "hosting_" & Split(Trim(adoConsulta.Recordset("identificador")), ".")(0)
archivoCompleto = App.Path & "/datosHosting/" & nomArchivo & ".doc"
archivoCompletopdf = App.Path & "/datosHosting/" & nomArchivo & ".pdf"
.ActiveDocument.SaveAs nomArchivo & ".doc", wdFormatDocument, False, "", True, "", False, False, False, False, False
'.ActivePrinter = "Adobe PDF"
'.ActivePrinter = "Bullzip PDF Printer"
.ActivePrinter = "doPDF v7"
.Application.PrintOut
.ActiveDocument.Close
End With
Documento.Quit
Set Documento = Nothing
Timer1.Enabled = True
Else
MsgBox "Este cliente no tiene correo por favor ingresar para continuar con el proceso", , "TICOM S.C.R.L."
Exit Sub
End If
Y CLARO TENGO MI PLANTILLA WORD EN UNA CARPETA datosHosting. por favor espero q me puedan ayudar por ratos funciona y por ratos me bota error no se a q se debe
y tb tengo el timer su codigo es este
Private Sub Timer1_Timer()
If Timer1.Enabled = True Then
lblAdjunto = archivoCompletopdf
'ENVIAR CORREOS CON EL MESSAGE MAPI
'enviar los correos electronicos
'enviar con send mail
lstStatus.Clear
Screen.MousePointer = vbHourglass
'abrimos la factura
If rsFactura.State <> 0 Then rsFactura.Close
rsFactura.Open "select * from vistaFactura where cod_comprobante = " & Val(cod_comprobante) & "", cn, adOpenStatic, adLockOptimistic
'_____________________________________________________
htmlMensaje = htmlMensaje & "<b><FONT color='red'>Datos del Alojamiento Web</font></b><br><br>"
htmlMensaje = htmlMensaje & "<table width='700' border='3' cellpadding='1' cellspacing='1' bordercolor='#000000' bgcolor='#0066CC'>"
htmlMensaje = htmlMensaje & "<tr><td><table width='871' border='1' align='center' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>"
htmlMensaje = htmlMensaje & "<tr> <td height='113 bgcolor=' bgcolor='#003366'#002E5B'><div align='center'><FONT color='#003399' size='+7'><strong><font color='#FFFFFF'>TICOM</font></strong></FONT><font color='#FFFFFF'><BR />"
htmlMensaje = htmlMensaje & "<FONT color='#F09100' size='2'><strong>SOLUCIONES INFORMATICAS A NIVEL MUNDIAL</strong></FONT><FONT color='#FFFFFF' size='2'><BR />"
htmlMensaje = htmlMensaje & "<font face='Verdana, Arial, Helvetica, sans-serif'><strong>Av.</strong> Petit Thouars 1255 Of. 302<br />"
htmlMensaje = htmlMensaje & "<strong>Telf.:</strong> 2662540 / 7959969 <strong>Cel.</strong> 9-96929470 / 9-91554872</font></FONT></div></td>"
htmlMensaje = htmlMensaje & " "
htmlMensaje = htmlMensaje & "</tr>"
htmlMensaje = htmlMensaje & ""
htmlMensaje = htmlMensaje & ""
htmlMensaje = htmlMensaje & ""
htmlMensaje = htmlMensaje & ""
htmlMensaje = htmlMensaje & ""
'
htmlMensaje = htmlMensaje & "<tr>"
htmlMensaje = htmlMensaje & ""
htmlMensaje = htmlMensaje & "<td valign='top'>"
htmlMensaje = htmlMensaje & "<table width='864' border='0'>"
htmlMensaje = htmlMensaje & "<td width='17'> </td>"
htmlMensaje = htmlMensaje & "<td width='837'><p>Importancia: Alta<br>"
htmlMensaje = htmlMensaje & "<strong>SEÑORES de </strong><font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("razon") & "</font> <br>"
htmlMensaje = htmlMensaje & "Bienvenidos al servicio de Hosting con <strong>TICOM</strong> <br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
htmlMensaje = htmlMensaje & "<p>IMPORTANTE: IMPRIMA Y GUARDE ESTE EMAIL<br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
htmlMensaje = htmlMensaje & "<p>Con esta guía informativa dará los primeros pasos en el servicio de Hosting. El servicio de hosting funcionará pasado 24 a 48 horas del cambio de DNS en su dominio. <br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
htmlMensaje = htmlMensaje & "<p>TERMINOS Y CONDICIONES DEL SERVICIO DE HOSTING<br>"
htmlMensaje = htmlMensaje & "<p><font color='#FF0000'><strong>No Contenido Adulto</strong></font><br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
htmlMensaje = htmlMensaje & "<p>AGREGUE SU URL EN EL PORTAL DE TICOM (Gratis)<br>"
htmlMensaje = htmlMensaje & "<a href='http://www.ticomperu.com/inscribatuempresa.htm'>http://www.ticomperu.com/inscribatuempresa.htm</a><br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________</p>"
htmlMensaje = htmlMensaje & "<p>CARACTERISTICAS GENERALES DEL PLAN CONTRATADO</p>"
htmlMensaje = htmlMensaje & "<p>Dominio Alojado: www.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font> <br>"
htmlMensaje = htmlMensaje & "Tiempo de contrato: 1 año <br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
htmlMensaje = htmlMensaje & "<p>PANEL DE CONTROL DE HOSTING</p>"
htmlMensaje = htmlMensaje & "<p>Enlace: http://www.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font>/panel <br>"
htmlMensaje = htmlMensaje & "Usuario: <font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("login") & "</font><br>"
htmlMensaje = htmlMensaje & "Clave: <font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("password") & "</font></p>"
htmlMensaje = htmlMensaje & "<p>Nota:<br>"
htmlMensaje = htmlMensaje & "1.- Cambie la contraseña del panel de control para mayor seguridad<br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
htmlMensaje = htmlMensaje & "<p>PANEL DE CREAR EMAILS</p>"
htmlMensaje = htmlMensaje & "<p>Dentro del panel en la opcion mail<br>"
htmlMensaje = htmlMensaje & "Luego clic en Add/Remove/Manage Accounts<br>"
htmlMensaje = htmlMensaje & "Lugo clic en addcount<br>"
htmlMensaje = htmlMensaje & "Ingresar el mail y su password<br>"
htmlMensaje = htmlMensaje & "Luego hacer clic en <br>"
htmlMensaje = htmlMensaje & "crear<br>"
htmlMensaje = htmlMensaje & "_________________________________________________________________________ </p>"
htmlMensaje = htmlMensaje & "<p>INTERFACE WEB PARA LEER EMAILS</p>"
htmlMensaje = htmlMensaje & "<p>http://www.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font>/webmail<br>"
htmlMensaje = htmlMensaje & "imp mail client<br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
htmlMensaje = htmlMensaje & "<p>DATOS DE CONEXIÓN PARA UN SOFTWARE</p>"
htmlMensaje = htmlMensaje & "<p>Sitio FTP: ftp.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font><br>"
htmlMensaje = htmlMensaje & "Usuario: <font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("login") & "</font> <br>"
htmlMensaje = htmlMensaje & "Clave: <font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("password") & "</font><br>"
htmlMensaje = htmlMensaje & "__________________________________________________________________________ </p>"
htmlMensaje = htmlMensaje & "<p>CONFIGURACION DE CUENTA DE EMAIL EN OUTLOOK O SIMILARES</p>"
htmlMensaje = htmlMensaje & "<p>1.- Ir a: Herramientas -> Cuentas... -> Agregar Cuenta de correo</p>"
htmlMensaje = htmlMensaje & "<p>2.- En la pestaña "General": <br>"
htmlMensaje = htmlMensaje & "Dirección de correo electrónico: sucuenta@<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font> <br>"
htmlMensaje = htmlMensaje & "Activar check "Incluir la cuenta al recibir correo electrónico o sincronizar" </p>"
htmlMensaje = htmlMensaje & "<p>3.- En la pestaña "Servidores": <br>"
htmlMensaje = htmlMensaje & "POP3: mail.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font><br>"
htmlMensaje = htmlMensaje & "SMTP: mail.<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font><br>"
htmlMensaje = htmlMensaje & "Nombre de cuenta: sucuenta@<font size='2' face='Verdana, Arial, Helvetica, sans-serif'>" & adoConsulta.Recordset("identificador") & "</font> (OjO) <br>"
htmlMensaje = htmlMensaje & "Clave: suclave <br>"
htmlMensaje = htmlMensaje & "Active check "Recordar contraseña" <br>"
htmlMensaje = htmlMensaje & "Desactive check "Iniciar sesión usando autenticación de contraseña segura." <br>"
htmlMensaje = htmlMensaje & "Active check "Mi servidor requiere autenticación" (OjO)<br>"
htmlMensaje = htmlMensaje & " (El botón "configuración..." se activará, click y seleccione) <br>"
htmlMensaje = htmlMensaje & " (*) Usar misma configuración que el servidor de correo entrante. </p>"
htmlMensaje = htmlMensaje & "<p>Nota: Antes debe crear la cuenta de Email en el panel de control de hosting.<br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p>"
htmlMensaje = htmlMensaje & "<p>SOPORTE TECNICO ESPAÑOL</p>"
htmlMensaje = htmlMensaje & "<p>Email: <a href='mailto:james@ticomperu.com'>informes@ticomperu.com</a> 24x7<br>"
htmlMensaje = htmlMensaje & "Teléfono: 7959969 Lunes a Viernes - 10:00 AM a 6:00 PM. <strong>Cel.</strong> (062)962759419, (62)962928634<br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________</p>"
htmlMensaje = htmlMensaje & "<p> <strong>"Trabajamos para servirle mejor"</strong></p>"
htmlMensaje = htmlMensaje & "<p>Atte.</p>"
htmlMensaje = htmlMensaje & "<p><font color='#000066'><strong>TICOM SRL</strong></font><br>"
htmlMensaje = htmlMensaje & " Soluciones Informáticas a Nivel Mundial<br>"
htmlMensaje = htmlMensaje & "_____________________________________________________________________</p>"
htmlMensaje = htmlMensaje & "IMPORTANTE: IMPRIMA Y GUARDE ESTE EMAIL<br>"
htmlMensaje = htmlMensaje & "___________________________________________________________________________ </p></td>"
htmlMensaje = htmlMensaje & "</tr>"
htmlMensaje = htmlMensaje & "</table></td>"
htmlMensaje = htmlMensaje & ""
htmlMensaje = htmlMensaje & " "
htmlMensaje = htmlMensaje & " "
htmlMensaje = htmlMensaje & "</tr>"
'
htmlMensaje = htmlMensaje & ""
htmlMensaje = htmlMensaje & ""
htmlMensaje = htmlMensaje & "<tr>"
htmlMensaje = htmlMensaje & "<td> </td>"
htmlMensaje = htmlMensaje & " "
htmlMensaje = htmlMensaje & ""
htmlMensaje = htmlMensaje & "</tr>"
htmlMensaje = htmlMensaje & "<FONT size='1'> </FONT> "
htmlMensaje = htmlMensaje & ""
htmlMensaje = htmlMensaje & "</table></td></tr></table>"
'___________________________________________________________________
With sendmail1
'Valida (opcional)
.SMTPHostValidacion = VALIDATE_HOST_NONE
'Valida la sintaxis de l cuenta (opcional)
.ValidarEmail = VALIDATE_SYNTAX
'Opcional
.Delimitador = ";"
'Texto para visualizar en el campo De (opcional)
.FromDisplayName = " TICOM S.C.R.L. "
'Requerido (Nombre del servidor SMTP)
.SMTPHost = "mail.ticomperu.com"
.Remitente = correousuario
'Requerido
.Destinatario = email1
'Copia normal [CC]
If email2 <> "" Then
'.CcDisplayName = email2
.CcRecipient = email2
Else
.CcRecipient = ""
End If
'Copia oculta [CCO]
If email3 <> "" Then
.BccRecipient = email3
Else
.BccRecipient = ""
End If
'Asunto del mensaje
.Asunto = "Datos del Hosting Contratado"
'Cuerpodel mensaje
.AsHTML = True
.Mensaje = htmlMensaje
'Adjunto (opcional)
.Adjunto = Trim(lblAdjunto)
'Opcional (Prioridad del mensaje)
.Prioridad = Alta
'Opcional (si requiere autentificación)
.UsarLoginSMTP = True
'Requerido si requiere autentificación
.Usuario = correousuario
.Password = passwordusuario
'txtServer.Text = .SMTPHost
'Opcional (por defectoutiliza el Tipo MIME)
.Codificacion = MIME_ENCODE
'Envia el Mail
.EnviarEmail
End With
Screen.MousePointer = vbDefault
''''''''''''''''''''''''''''''''
Timer1.Enabled = False
nomArchivo = ""
archivoCompleto = ""
archivoCompletopdf = ""
lblAdjunto = ""
End If