Hi guys!
I´ve got the following code to send invoices to our clients.
It works fine except with one of our clients. when trying to send it allways rejects the email and i get an email in my inbox with error “ADRESS NOT FOUND”.
from chrome, in gmail i send emails to that same clients address and no problem is present, the email is sent correctly. not like that from my xojo application.
any clues why i can not send it to this client?
in every email i send, at the end, i get the code error 102, even if it sends it correctly or not.
regards,
dim em as new EmailMessage
dim file as new EmailAttachment
dim rs as recordSet
dim emailCliente, s, auxStr As String
dim i As Integer
emailCliente = "tesorerialagranbodega@gmail.com"
em = New EmailMessage
em.FromAddress = "abastecedora2017@gmail.com" //"abastecedora2017@gmail.com"
em.Subject = "APPSA - CFDI " + VentaSerie.Text + VentafolioPapelFactura.Text
em.BodyPlainText = "Se anexa comprobante fiscal digital." + EndOfLine + "Que tenga un excelente día!"
em.headers.AppendHeader "X-Mailer","Envio de CFDI a clientes"
// add recipients
s = ReplaceAll(emailCliente, ",", Chr(13))
s = ReplaceAll(s, Chr(13)+Chr(10), Chr(13))
For i = 1 To CountFields(s, Chr(13))
auxStr = ("<" + Trim(NthField(s, Chr(13), i)) + ">")
em.AddRecipient("<" + Trim(NthField(s, Chr(13), i)) + ">")
Next
MailSocket.Address ="smtp.gmail.com"
MailSocket.Port = 465
MailSocket.ConnectionType = SMTPSecureSocket.TLSv12
MailSocket.SMTPConnectionMode = SMTPSecureSocket.ModeSSLTLS
MailSocket.Secure = True
MailSocket.Username = "abastecedora2017" //"abastecedora2017"
MailSocket.Password = XXXX
// add attachments
file = New EmailAttachment
file.LoadFromFile(GetFolderItem("C:\\APP\\RegistroCFDI\" + VentaFolioPapelFactura.Text + ".xml"))
em.Attachments.Append(file)
file = New EmailAttachment
file.LoadFromFile(GetFolderItem("C:\\APP\\RegistroCFDI\" + VentaFolioPapelFactura.Text + ".pdf"))
em.Attachments.Append(file)
// send the email
MailSocket.Messages.Append(em)
MailSocket.SendMail