Hello,
Using net library is a perfect way to sending email.
But how can I send them, on the background, setting a different account from the field "sender"? Right now it works only with the device account or not?
I don't understand.
The initialize method of smtp call: Initialize (Server AsString, Port AsInt, Username AsString, Password AsString, EventName AsString)
If I use this code (assuming that "AAA@gmail.com" is my gmail account and the same that I use the phone):
B4X:
Dim mailSMTP As SMTP
mail.Initialize("smtp.gmail.com", 587, "AAA@gmail.com", "PWDAAA", "SMTP")
mail.StartTLSMode = True
mail.To.Add("AAA@gmail.com")
mail.Subject = "This is the subject"
mail.Body = "This is the message body."
mail.Send
I receive a mail from myself.
But if I set another account gmail when I initialize the variable "mail", the app doesn't send the mail.
hi
you can open a gmail account just for sending this kind of mail.
( so the password issue will not be a big thing )
and then change the settings of the gmail account of
" access for less secure apps" to enabled.
and then the net library smtp function works great.
Gmail can and will fail if you are sending from a different city, location. So if you live in lets say Seattle, Wa. USA and someone in using your app in Europe. It will fail.