Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

sendmail y gmail

Estas en el tema de sendmail y gmail en el foro de Visual Basic clásico en Foros del Web. Hola utilizo un modulo de clase de sendmail (sendmail.cls), que descargue con un ejemplo, e intento enviar un mail con gmail. Utilizo el servidor smtp.gmail.com, ...
  #1 (permalink)  
Antiguo 11/02/2011, 16:03
mgd
 
Fecha de Ingreso: enero-2009
Mensajes: 129
Antigüedad: 15 años, 2 meses
Puntos: 0
sendmail y gmail

Hola utilizo un modulo de clase de sendmail (sendmail.cls), que descargue con un ejemplo, e intento enviar un mail con gmail.
Utilizo el servidor smtp.gmail.com, mi usuario y contraseña y también
.UseAuthentication = bAuthLogin (TRUE)
pero me da error:

Must issue a STARTTLS command firts.

Supongo que tiene que ver con SSL pero no encontre ninguna propiedad donde pueda poner SSL = True

Si utilizo un dominio propio que no requiere atentificacion ni SSL anda muy bien pero con gmail o hotmail no puedo hacerlo:

Este es el ejemplo:

Código vb6:
Ver original
  1. Gracias por su ayuda
  2.  
  3. Private Sub cmdSend_Click()
  4.  
  5.     ' *****************************************************************************
  6.     ' This is where all of the Components Properties are set / Methods called
  7.     ' *****************************************************************************
  8.  
  9.     cmdSend.Enabled = False
  10.     lstStatus.Clear
  11.     Screen.MousePointer = vbHourglass
  12.  
  13.     With poSendMail
  14.  
  15.         ' **************************************************************************
  16.         ' Optional properties for sending email, but these should be set first
  17.         ' if you are going to use them
  18.         ' **************************************************************************
  19.  
  20.         .SMTPHostValidation = VALIDATE_NONE         ' Optional, default = VALIDATE_HOST_DNS
  21.         .EmailAddressValidation = VALIDATE_SYNTAX   ' Optional, default = VALIDATE_SYNTAX
  22.         .Delimiter = ";"                            ' Optional, default = ";" (semicolon)
  23.  
  24.         ' **************************************************************************
  25.         ' Basic properties for sending email
  26.         ' **************************************************************************
  27.         .SMTPHost = txtServer.Text                  ' Required the fist time, optional thereafter
  28.         .From = txtFrom.Text                        ' Required the fist time, optional thereafter
  29.         .FromDisplayName = txtFromName.Text         ' Optional, saved after first use
  30.         .Recipient = txtTo.Text                     ' Required, separate multiple entries with delimiter character
  31.         .RecipientDisplayName = txtToName.Text      ' Optional, separate multiple entries with delimiter character
  32.         .CcRecipient = txtCc                        ' Optional, separate multiple entries with delimiter character
  33.         .CcDisplayName = txtCcName                  ' Optional, separate multiple entries with delimiter character
  34.         .BccRecipient = txtBcc                      ' Optional, separate multiple entries with delimiter character
  35.         .ReplyToAddress = txtFrom.Text              ' Optional, used when different than 'From' address
  36.         .Subject = txtSubject.Text                  ' Optional
  37.         .Message = txtMsg.Text                      ' Optional
  38.         .Attachment = Trim(txtAttach.Text)          ' Optional, separate multiple entries with delimiter character
  39.  
  40.         ' **************************************************************************
  41.         ' Additional Optional properties, use as required by your application / environment
  42.         ' **************************************************************************
  43.         .AsHTML = bHtml                             ' Optional, default = FALSE, send mail as html or plain text
  44.         .ContentBase = ""                           ' Optional, default = Null String, reference base for embedded links
  45.         .EncodeType = MyEncodeType                  ' Optional, default = MIME_ENCODE
  46.         .Priority = etPriority                      ' Optional, default = PRIORITY_NORMAL
  47.         .Receipt = bReceipt                         ' Optional, default = FALSE
  48.         .UseAuthentication = bAuthLogin             ' Optional, default = FALSE
  49.         .UsePopAuthentication = bPopLogin           ' Optional, default = FALSE
  50.         .Username = txtUserName                     ' Optional, default = Null String
  51.         .Password = txtPassword                     ' Optional, default = Null String, value is NOT saved
  52.         .POP3Host = txtPopServer
  53.         .MaxRecipients = 100                        ' Optional, default = 100, recipient count before error is raised
  54.         .SMTPPort = 587
  55.         ' **************************************************************************
  56.         ' Advanced Properties, change only if you have a good reason to do so.
  57.         ' **************************************************************************
  58.         ' .ConnectTimeout = 10                      ' Optional, default = 10
  59.         ' .ConnectRetry = 5                         ' Optional, default = 5
  60.         ' .MessageTimeout = 60                      ' Optional, default = 60
  61.         ' .PersistentSettings = True                ' Optional, default = TRUE
  62.         ' .SMTPPort = 25                            ' Optional, default = 25
  63.  
  64.         ' **************************************************************************
  65.         ' OK, all of the properties are set, send the email...
  66.         ' **************************************************************************
  67.         ' .Connect                                  ' Optional, use when sending bulk mail
  68.         .Send                                       ' Required
  69.         ' .Disconnect                               ' Optional, use when sending bulk mail
  70.         txtServer.Text = .SMTPHost                  ' Optional, re-populate the Host in case
  71.                                                     ' MX look up was used to find a host    End With
  72.     End With
  73.     Screen.MousePointer = vbDefault
  74.     cmdSend.Enabled = True
  75.  
  76. End Sub

También he probado esto mismo con un ocx llamado mail.ocx , no tiene la propiedad de SSL y me da el mismo error

gracias
  #2 (permalink)  
Antiguo 11/02/2011, 22:03
 
Fecha de Ingreso: enero-2008
Ubicación: Lima - Perú
Mensajes: 1.127
Antigüedad: 16 años, 3 meses
Puntos: 10
Respuesta: sendmail y gmail

Yo he utilizado esta DLL y me funciona bien, espero te sirva.

Puedes colocar cual es el SMTP de hotmail por que solo llegue a probar con yahoo y gmail
  #3 (permalink)  
Antiguo 12/02/2011, 07:07
mgd
 
Fecha de Ingreso: enero-2009
Mensajes: 129
Antigüedad: 15 años, 2 meses
Puntos: 0
Respuesta: sendmail y gmail

Es lo mismo que estoy usando yo pero me tira ese error, podrías enviarme un ejemplo?
  #4 (permalink)  
Antiguo 12/02/2011, 10:38
 
Fecha de Ingreso: enero-2008
Ubicación: Lima - Perú
Mensajes: 1.127
Antigüedad: 16 años, 3 meses
Puntos: 10
Respuesta: sendmail y gmail

Efectivamente el ejemplo que te he dado no funciona con GMAIL solo funciona bien con YAHOO.

Aqui hay otro ejemplo el cual he probado enviando de YAHOO y GMAIL a HOTMAIL y funciono bien.

NOTA: casi siempre van a correo NO DESEADO si no los tienes como remitentes seguros, al menos asi me pasaba con yahoo y utilizando el 1er ejemplo, el 2do ejemplo no lo he probado mucho.

Saludos
  #5 (permalink)  
Antiguo 14/02/2011, 07:04
mgd
 
Fecha de Ingreso: enero-2009
Mensajes: 129
Antigüedad: 15 años, 2 meses
Puntos: 0
Respuesta: sendmail y gmail

Creo que mejor lo hago con .Net
Estuve mirando unos ejemplos y de manera un poco mas simple funciono muy bien
Muchas gracias por tu ayuda

Etiquetas: gmail, sendmail
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:44.