Macro en Excel para enviar correos a varias personas con hotmail

Dante

Espero te encuentres bien.

Quería molestarte con la siguiente duda. Requiero poder enviar correos con texto y PDF o archivos de Excel a varios terceros desde HOTMAIL pero que se realice de manera automática a cada uno de ellos.

Necesito enviarlos por correo GMAIL.

1 Respuesta

Respuesta
1

Para enviar por hotmail, cambia en la macro por tu usuario y password de hotmail:

correo = "[email protected]"
passwd = "pwd"

Sub EnviarPorGmail()
'Por.Dante Amor
    Dim Email As CDO.Message
    correo = "[email protected]"
    passwd = "pwd"
    For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
        Set Email = New CDO.Message
        Email.Configuration.Fields(cdoSMTPServer) = "smtp.live.com"
        Email.Configuration.Fields(cdoSendUsingMethod) = 2
        With Email.Configuration.Fields
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = CLng(25)
            .Item("http://schemas.microsoft.com/cdo/" & "configuration/smtpauthenticate") = Abs(1)
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = correo
            .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = passwd
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
        End With
        '
        With Email
            .To = Cells(i, "A")
            .From = correo
            .Subject = Cells(i, "B")
            .TextBody = Cells(i, "C")
            .AddAttachment Cells(i, "E") & Cells(i, "D")
            .Configuration.Fields.Update
            On Error Resume Next
            .Send
        End With
        If Err.Number = 0 Then
            Cells(i, "F") = "El mail se envió con éxito"
        Else
            Cells(i, "F") = "Se produjo el siguiente error: " & Err.Number & " " & Err.Description
        End If
        Set Email = Nothing
    Next
End Sub

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas