I have created a vb.net application to run in raspbian os. The application is supposed to send an email using SMTP. The code from the laptop can send the mail but in raspberry pi, it is not working
it does not send any mail and it crashes the system.
Error message : default credentials are not supported
The code:
Imports System.Net.Mail
Imports System.Data
Imports System.Net
Try
Dim html As String = "<table cellpadding='5' cellspacing='0' style='font-size: 9pt'>"
html &= "<tr>"
For Each column As DataGridViewColumn In formPOS.ProductAddToCartDGV.Columns
html &= "<th style='background-color: #B8DBFD;border: 1px solid #ccc'>" & column.HeaderText & "</th>"
Next
html &= "</tr>"
For Each row As DataGridViewRow In formPOS.ProductAddToCartDGV.Rows
html &= "<tr>"
For Each cell As DataGridViewCell In row.Cells
html &= "<td style='width:120px;border: 1px solid #ccc'>" & cell.Value & "</td>"
Next
html &= "</tr>"
Next
html &= "<tr>"
html &= "<td style='border: 0px solid #fff'></td>"
html &= "<td style='border: 0px solid #fff'></td>"
html &= "<td style='border: 0px solid #fff'></td>"
html &= "<td style='background-color: #dcdcdc;border: 0px;'><b> TOTAL ITEM: </b></td>"
html &= "<td style='background-color: #dcdcdc;border: 0px; text-align: center;'><b>" & formPOS.useritemLBL.Text & "</b></td>"
html &= "</tr>"
html &= "<tr>"
html &= "<td style='border: 0px solid #fff'></td>"
html &= "<td style='border: 0px solid #fff'></td>"
html &= "<td style='border: 0px solid #fff'></td>"
html &= "<td style='background-color: #dcdcdc;border: 0px;'><b>SUB TOTAL: </b></td>"
html &= "<td style='background-color: #dcdcdc;border: 0px; text-align: center;'><b>" & formPOS.userTotalLBL.Text & "</b></td>"
html &= "</tr>"
html &= "</table>"
Using mm As New MailMessage("workserver@gmail.com", formPOS.customerEmailTb.Text)
mm.Subject = "Smart Shopping Cart e-Receipt"
mm.Body = html
mm.IsBodyHtml = True
Dim smtp As New SmtpClient()
smtp.Host = "smtp.gmail.com"
smtp.EnableSsl = True
Dim NetworkCred As New NetworkCredential(mm.From.Address, "password")
smtp.UseDefaultCredentials = True
smtp.Credentials = NetworkCred
smtp.Port = 587
smtp.Send(mm)
End Using
Catch ex As Exception
MsgBox(ex.Message)
End Try
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…