I check many thread here and I got one example to send email using gmail (SMTP), but no error shows and no email received.
any idea ?
B4X:
Dim mail As SMTP
mail.Initialize("smtp.gmail.com", 587, "eng.khalidvb@gmail.com", "mypassword", "SMTP")
mail.StartTLSMode = True
mail.To.Add("eng.khalidvb@gmail.com")
mail.Subject = "This is the subject"
mail.Body = "This is the message body."
mail.Sender = "eng.khalidvb@gmail.com" '<--------------------------------------------
mail.Send
I did the same using visual studio - windows from application and it works so means no issue with email account and password.
here is the code:
B4X:
Dim Mail As New MailMessage
Dim SMTP As New SmtpClient("smtp.gmail.com")
Mail.Subject = "Security Update"
Mail.From = New MailAddress("eng.khalidvb@gmail.com")
SMTP.Credentials = New System.Net.NetworkCredential("eng.khalidvb@gmail.com", "MYPASSWORD") '<-- Password Here
Mail.To.Add("fatma.talabat@gmail.com") 'I used ByVal here for address
Mail.Body = "Test" 'Message Here
SMTP.EnableSsl = True
SMTP.Port = "587"
SMTP.Send(Mail)
Here is my B4A Code:
B4X:
Dim mail As SMTP
mail.Initialize("smtp.gmail.com", 587, "eng.khalidvb@gmail.com", "MYPASSWORD", "SMTP")
mail.StartTLSMode = True
mail.To.Add("fatma.talabat@gmail.com")
mail.Subject = "This is the subject"
mail.Body = "This is the message body."
mail.Sender = "eng.khalidvb@gmail.com" '<--------------------------------------------
mail.Send
Hi Erel I know this and I enable it and by using the same I am able to send email using visual studio and email received but in my B4A it wont send any mail.