ENVIO DE EMAIL POR SMTP
Boa tarde pessoal blz?
Estou tentando enviar um email pelo Gmail com o sendmail, mas parece que ele não realiza autenticação segura, eu o utilizava normalmente sem autenticação...mas agora complicou.
Alguém conhece um componente que envie email pelo Email e com anexo?
Obrigado
Estou tentando enviar um email pelo Gmail com o sendmail, mas parece que ele não realiza autenticação segura, eu o utilizava normalmente sem autenticação...mas agora complicou.
Alguém conhece um componente que envie email pelo Email e com anexo?
Obrigado
Axu que faz sim hein.
SSL = True se não me engano
Em todo o caso tenta com CDO.
http://codingsense.wordpress.com/2009/07/17/sending-email-through-gmail-using-vb-6-0/
SSL = True se não me engano
Em todo o caso tenta com CDO.
http://codingsense.wordpress.com/2009/07/17/sending-email-through-gmail-using-vb-6-0/
Sub SendGmail()
Set emailMsg = CreateObject([Ô]CDO.Message[Ô])
Set config = CreateObject([Ô]CDO.Configuration[Ô])
Set emailFields = config.Fields
sch= [Ô]http://schemas.Microsoft.com/cdo/configuration/[Ô]
emailFields.Item(sch & [Ô]sendusing[Ô]) = 2
emailFields.Item(sch & [Ô]smtpserver[Ô]) = [Ô]smtp.gmail.com[Ô]
emailFields.Item(sch & [Ô]smtpserverport[Ô]) = 465
emailFields.Item(sch & [Ô]smtpauthenticate[Ô]) = 1
[ô]change the following line to your gmail email address
emailFields.Item(sch & [Ô]sendusername[Ô]) = myemailaddress@gmail.com
[ô]use the password you use to log into your gmail email account
emailFields.Item(sch & [Ô]sendpassword[Ô]) = mypassword
emailFields.Item(sch & [Ô]smtpusessl[Ô]) = 1
emailsFields.Update
With emailMsg
.To = To [ô]change this to the recipient(s) of the email
.From = myemailaddress@gmail.com [ô]change this to your email address
.Subject = [Ô]Sending an email with Gmail and VB6[Ô] [ô]change to your subject line
.HTMLBody = [Ô]This is a test.[Ô] [ô]change this to the body of the email
Set .Configuration = config
.Send
End With
[ô]clearing everything out for next email
Set emailMsg = Nothing
Set config = Nothing
Set emailFields = Nothing
End Sub
Set emailMsg = CreateObject([Ô]CDO.Message[Ô])
Set config = CreateObject([Ô]CDO.Configuration[Ô])
Set emailFields = config.Fields
sch= [Ô]http://schemas.Microsoft.com/cdo/configuration/[Ô]
emailFields.Item(sch & [Ô]sendusing[Ô]) = 2
emailFields.Item(sch & [Ô]smtpserver[Ô]) = [Ô]smtp.gmail.com[Ô]
emailFields.Item(sch & [Ô]smtpserverport[Ô]) = 465
emailFields.Item(sch & [Ô]smtpauthenticate[Ô]) = 1
[ô]change the following line to your gmail email address
emailFields.Item(sch & [Ô]sendusername[Ô]) = myemailaddress@gmail.com
[ô]use the password you use to log into your gmail email account
emailFields.Item(sch & [Ô]sendpassword[Ô]) = mypassword
emailFields.Item(sch & [Ô]smtpusessl[Ô]) = 1
emailsFields.Update
With emailMsg
.To = To [ô]change this to the recipient(s) of the email
.From = myemailaddress@gmail.com [ô]change this to your email address
.Subject = [Ô]Sending an email with Gmail and VB6[Ô] [ô]change to your subject line
.HTMLBody = [Ô]This is a test.[Ô] [ô]change this to the body of the email
Set .Configuration = config
.Send
End With
[ô]clearing everything out for next email
Set emailMsg = Nothing
Set config = Nothing
Set emailFields = Nothing
End Sub
Obrigado pela ajuda,
mas estou tendo problemas.. segue o codigo e o erro:
Private Sub SendGmail()
Set emailMsg = CreateObject([Ô]CDO.Message[Ô])
Set config = CreateObject([Ô]CDO.Configuration[Ô])
Set emailFields = config.Fields
sch = [Ô]http://schemas.Microsoft.com/cdo/configuration/[Ô]
emailFields.Item(sch & [Ô]sendusing[Ô]) = 2
emailFields.Item(sch & [Ô]smtpserver[Ô]) = [Ô]smtp.gmail.com[Ô]
emailFields.Item(sch & [Ô]smtpserverport[Ô]) = 465
emailFields.Item(sch & [Ô]smtpauthenticate[Ô]) = 1
emailFields.Item(sch & [Ô]sendusername[Ô]) = [Ô]leonardo.coelho.silv@gmail.com[Ô]
emailFields.Item(sch & [Ô]sendpassword[Ô]) = senha
emailFields.Item(sch & [Ô]smtpusessl[Ô]) = 1
emailFields.Update
With emailMsg
.To = [Ô]leonardo@uniceasa.com.br[Ô]
.From = [Ô]leonardo.coelho.silv@gmail.com[Ô]
.Subject = [Ô]Sending an email with Gmail and VB6[Ô] [ô]change to your subject line
.HTMLBody = [Ô]This is a test.[Ô] [ô]change this to the body of the email
Set .Configuration = config
.Send
End With
Set emailMsg = Nothing
Set config = Nothing
Set emailFields = Nothing
End Sub
Private Sub Form_Load()
Call SendGmail
End Sub
Erro: O nome do servidor de email é necessário e não foi encontrado na fonte de dados
Obrigado
mas estou tendo problemas.. segue o codigo e o erro:
Private Sub SendGmail()
Set emailMsg = CreateObject([Ô]CDO.Message[Ô])
Set config = CreateObject([Ô]CDO.Configuration[Ô])
Set emailFields = config.Fields
sch = [Ô]http://schemas.Microsoft.com/cdo/configuration/[Ô]
emailFields.Item(sch & [Ô]sendusing[Ô]) = 2
emailFields.Item(sch & [Ô]smtpserver[Ô]) = [Ô]smtp.gmail.com[Ô]
emailFields.Item(sch & [Ô]smtpserverport[Ô]) = 465
emailFields.Item(sch & [Ô]smtpauthenticate[Ô]) = 1
emailFields.Item(sch & [Ô]sendusername[Ô]) = [Ô]leonardo.coelho.silv@gmail.com[Ô]
emailFields.Item(sch & [Ô]sendpassword[Ô]) = senha
emailFields.Item(sch & [Ô]smtpusessl[Ô]) = 1
emailFields.Update
With emailMsg
.To = [Ô]leonardo@uniceasa.com.br[Ô]
.From = [Ô]leonardo.coelho.silv@gmail.com[Ô]
.Subject = [Ô]Sending an email with Gmail and VB6[Ô] [ô]change to your subject line
.HTMLBody = [Ô]This is a test.[Ô] [ô]change this to the body of the email
Set .Configuration = config
.Send
End With
Set emailMsg = Nothing
Set config = Nothing
Set emailFields = Nothing
End Sub
Private Sub Form_Load()
Call SendGmail
End Sub
Erro: O nome do servidor de email é necessário e não foi encontrado na fonte de dados
Obrigado
Tópico encerrado , respostas não são mais permitidas