Ver Mensaje Individual
  #2 (permalink)  
Antiguo 26/03/2007, 00:53
Insomnia
 
Fecha de Ingreso: noviembre-2005
Mensajes: 751
Antigüedad: 19 años, 6 meses
Puntos: 13
Re: Como Mando Mails Con Arhvs Adjuntos??? en vb6

Hola

Te dejo el código que utilizo para realizarlo, tienes que agregar al proyecto el componente microsoft MAPI controls

Código:
 On Error GoTo errorea
    
    
    'sesion de correo
    With MAPISession1
        .UserName = "Insomnia"
        .NewSession = True
        .DownLoadMail = False
        .SignOn
    End With
    
    With MAPIMessages1
        .SessionID = MAPISession1.SessionID
        .MsgIndex = -1
        
    'destinatario
        .RecipIndex = 0
        .RecipType = mapToList
            
        'Para coger la dirección email de la BD
        Dim bdmail As New ADODB.Connection
        bdmail.Open sConexion
        Dim regmail As New ADODB.Recordset
        regmail.Open "Select email, ccemail from proveedores where empresa='" & Proveedor.Text & "'", bdmail, adOpenStatic, adLockOptimistic

        .RecipDisplayName = regmail.Fields(0)
     
    'CC a
        .RecipIndex = 1
        .RecipType = mapCcList
        If Not IsNull(regmail.Fields(1)) Then
            .RecipDisplayName = regmail.Fields(1)
        Else
            .RecipDisplayName = regmail.Fields(0)
        End If
    
    'Asunto
        .MsgSubject = "Texto del Asunto"
        
    'Texto del mensaje
        .MsgNoteText = "Texto que deseamos enviar"
        
    'Fichero adjunto
        .AttachmentPathName = Pedido.Text
        .AttachmentName = Pedido.Text
        .AttachmentType = mapData
        .AttachmentPosition = Len(.MsgNoteText) - 1
        .Send True
    End With
    
    MAPISession1.SignOff
    
    regmail.Close
    Set regmail = Nothing
    bdmail.Close
--Saludos--