eng.khalidvb Member Licensed User Longtime User Mar 14, 2018 #1 Hello all, 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 ? Code: Copy Dim mail As SMTP mail.Initialize("smtp.gmail.com", 587, "[email protected]", "mypassword", "SMTP") mail.StartTLSMode = True mail.To.Add("[email protected]") mail.Subject = "This is the subject" mail.Body = "This is the message body." mail.Sender = "[email protected]" '<-------------------------------------------- mail.Send
Hello all, 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 ? Code: Copy Dim mail As SMTP mail.Initialize("smtp.gmail.com", 587, "[email protected]", "mypassword", "SMTP") mail.StartTLSMode = True mail.To.Add("[email protected]") mail.Subject = "This is the subject" mail.Body = "This is the message body." mail.Sender = "[email protected]" '<-------------------------------------------- mail.Send
hatzisn Expert Licensed User Longtime User Mar 15, 2018 #2 Which library do you use for SMTP? Upvote 0
eng.khalidvb Member Licensed User Longtime User Mar 15, 2018 #3 hatzisn said: Which library do you use for SMTP? Click to expand... Net (Version 1.75) Upvote 0
eng.khalidvb Member Licensed User Longtime User Mar 15, 2018 #4 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: Code: Copy Dim Mail As New MailMessage Dim SMTP As New SmtpClient("smtp.gmail.com") Mail.Subject = "Security Update" Mail.From = New MailAddress("[email protected]") SMTP.Credentials = New System.Net.NetworkCredential("[email protected]", "MYPASSWORD") '<-- Password Here Mail.To.Add("[email protected]") '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: Code: Copy Dim mail As SMTP mail.Initialize("smtp.gmail.com", 587, "[email protected]", "MYPASSWORD", "SMTP") mail.StartTLSMode = True mail.To.Add("[email protected]") mail.Subject = "This is the subject" mail.Body = "This is the message body." mail.Sender = "[email protected]" '<-------------------------------------------- mail.Send any idea ? Upvote 0
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: Code: Copy Dim Mail As New MailMessage Dim SMTP As New SmtpClient("smtp.gmail.com") Mail.Subject = "Security Update" Mail.From = New MailAddress("[email protected]") SMTP.Credentials = New System.Net.NetworkCredential("[email protected]", "MYPASSWORD") '<-- Password Here Mail.To.Add("[email protected]") '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: Code: Copy Dim mail As SMTP mail.Initialize("smtp.gmail.com", 587, "[email protected]", "MYPASSWORD", "SMTP") mail.StartTLSMode = True mail.To.Add("[email protected]") mail.Subject = "This is the subject" mail.Body = "This is the message body." mail.Sender = "[email protected]" '<-------------------------------------------- mail.Send any idea ?
f0raster0 Well-Known Member Licensed User Longtime User Mar 16, 2018 #5 check your gmail, you could be getting a security warning Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Mar 16, 2018 #6 You need to allow "less secure applications" in your gmail account. Upvote 0
eng.khalidvb Member Licensed User Longtime User Mar 16, 2018 #7 Erel said: You need to allow "less secure applications" in your gmail account. Click to expand... 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. I belive there is an issue with my code. Upvote 0
Erel said: You need to allow "less secure applications" in your gmail account. Click to expand... 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. I belive there is an issue with my code.
Erel B4X founder Staff member Licensed User Longtime User Mar 18, 2018 #8 Where is the MessageSent sub? You should check LastException value. Upvote 0