Hola ¿tu sabriás dedcirme como enviar un correo desde una aplicación en V-Basic 4.0? Se que desde la 5.0 si se puuede, pero desde la 4.0 no he encontrado nada. Muchas gracias.
Antes que nada da de alta la libreria Microsoft MAPI Controls y checa la rutina siguiente: Private Function EnviarCorreo(ByVal Tema As String, ByVal Email As String, ByVal Texto As String, ByVal Llave As String) As Date Dim Receptores() As String, X As Long, Temp ReDim Receptores(0 To 0) EnviarCorreo = Si 'MAPI constants from CONSTANT.TXT file: Const SESSION_SIGNON = 1 Const MESSAGE_COMPOSE = 6 Const ATTACHTYPE_DATA = 0 Const RECIPTYPE_TO = 1 Const RECIPTYPE_CC = 2 Const MESSAGE_RESOLVENAME = 13 Const MESSAGE_SEND = 3 Const SESSION_SIGNOFF = 2 MAPISession.LogonUI = No On Error Resume Next MAPISession.Action = mapSignOn 'SESSION_SIGNON If Val(Err.Number) <> 32050 And Err.Number <> 0 Then '*** Atrapado de Errores JLLog "Error: Al intentar enviar el correo, se produjo el error " + Format(Err.Number) + ") " + Err. Description EnviarCorreo = No Exit Function End If On Error GoTo 0 MAPIMessages.SessionID = MAPISession.SessionID MAPIMessages.Action = MESSAGE_COMPOSE 'Start a new message MAPIMessages.MsgSubject = Tema + " {" + Llave + "}" MAPIMessages.MsgNoteText = Texto 'Separar Recipients Temp = 0 For X = 1 To Len(Email) If Mid(Email, X, 1) = ";" Then Temp = Temp + 1 Next ReDim Receptores(0 To Temp) Temp = Email X = -1 Do While InStr(1, Temp, ";") > 0 X = X + 1 Receptores(X) = Left(Temp, InStr(1, Temp, ";") - 1) MAPIMessages.RecipIndex = X 'First recipient MAPIMessages.RecipType = RECIPTYPE_TO 'Recipient in TO line MAPIMessages.RecipDisplayName = Receptores(X) 'e-mail name MAPIMessages.MsgReceiptRequested = True Temp = Trim(Mid(Temp, InStr(1, Temp, ";") + 1)) Loop X = X + 1 Receptores(X) = Trim(Temp) 'Set the recipients MAPIMessages.RecipIndex = X 'First recipient MAPIMessages.RecipType = RECIPTYPE_TO 'Recipient in TO line MAPIMessages.RecipDisplayName = Receptores(X) 'e-mail name MAPIMessages.MsgReceiptRequested = True On Error Resume Next MAPIMessages.Action = MESSAGE_RESOLVENAME If Err.Number <> 0 Then EnviarCorreo = No JLLog "Error: Al intentar enviar el correo, se produjo el error " + Format(Err.Number) + ") " + Err. Description JLLog "El correo va dirigido a: " + Email JLLog Format(UBound(Receptores)) + " receptores de correo" Exit Function End If On Error GoTo 0 MAPIMessages.Action = MESSAGE_SEND MAPISession.Action = SESSION_SIGNOFF End Function