I have a question about smtp mails, does it still work?
this is my old code that was working fine and i have seen this post but i can't
I can't get it to work, in gmail I have already created the key for the app.
I would be grateful if someone could instruct me or confirm if my code could still work.
the log
this is my old code that was working fine and i have seen this post but i can't
I can't get it to work, in gmail I have already created the key for the app.
I would be grateful if someone could instruct me or confirm if my code could still work.
B4X:
Sub SendMail(FirstTime As Boolean)
'ToastMessageShow("Enviando mensaje", True)
If FirstTime=True Then
smtp.Initialize("smtp.gmail.com", 587, "[email protected]", "password", "SMTP")
smtp.StartTLSMode = True
End If
smtp.To.Add(GlobalParameters.Email)
smtp.Subject = "Confirmación de Orden Palominos APP"
smtp.HtmlBody=True
Dim BodyTemp As String
BodyTemp = File.ReadString(File.DirAssets, "mailfactura.html")
BodyTemp = BodyTemp.Replace ("%= listado_compras %", "Orden #"&GlobalParameters.orderidactual&" PalominosAPP")
BodyTemp = BodyTemp.Replace ("%= usuario_email %", GlobalParameters.Username)
BodyTemp = BodyTemp.Replace ("%= envio_email %", GlobalParameters.Email)
smtp.Body = BodyTemp
mapHeader.Put("Content-Transfer-Encoding", "7bit")
smtp.AdditionalHeaders = mapHeader
smtp.Send
End Sub
the log
B4X:
Waiting for debugger to connect...
Program started.
En la funcion que genera el pdf
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.read(BufferedReader.java:182)
at org.apache.commons.net.io.CRLFLineReader.readLine(CRLFLineReader.java:59)
at org.apache.commons.net.smtp.SMTP.__getReply(SMTP.java:196)
at org.apache.commons.net.smtp.SMTP.__sendCommand(SMTP.java:171)
at org.apache.commons.net.smtp.SMTP.sendCommand(SMTP.java:311)
at org.apache.commons.net.smtp.SMTP.sendCommand(SMTP.java:338)
at org.apache.commons.net.smtp.AuthenticatingSMTPClient.auth(AuthenticatingSMTPClient.java:171)
at anywheresoftware.b4a.net.SMTPWrapper$1.run(SMTPWrapper.java:270)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
false
Last edited: