I have this code, but keep getting "Failure Sending Email" message
server is smtp.gmail.com
Username is email address
Code works for 1and1 email addresses its just gmail it seems
Help is appreciatedCode:Sub SendTheMail() rp1.Emailer2(txtto.Text, txtFrom.Text, txtSubject.Text, txtMessage.Text, txtFrom.Text, "smtp.gmail.com", "*******", 465) End Sub Sub Emailer2(ByVal to_who As String, ByVal from_who As String, ByVal txtsubject As String, ByVal txtbody As String, ByVal UserName As String, ByVal smtpServerName As String, ByVal PasswordForEmailServer As String, ByVal aport As Integer) Dim SmtpServer As New SmtpClient(smtpServerName, aport) SmtpServer.EnableSsl = True SmtpServer.Credentials = New Net.NetworkCredential(UserName, PasswordForEmailServer) Dim mail As New MailMessage(from_who, to_who, txtsubject, txtbody) Try SmtpServer.Send(mail) Catch ex As Exception MsgBox(ex.Message) End Try End Sub




Reply With Quote
