Actually you forgot to input the port for Google SMTP server that is: 587
[php]Try
Dim msg As New MailMessage(senderID.Text, recievers.Text, subj.Text, emailbody.Text)
If Not CCs.Text = vbNullString Then
msg.CC.Add(CCs.Text)
End If
If Not BCCs.Text = vbNullString Then
msg.Bcc.Add(BCCs.Text)
End If
If attachments.Items.Count > 0 Then
For Each z As String In attachments.Items
msg.Attachments.Add(New Net.Mail.Attachment(z))
Next
End If
Dim client As New SmtpClient("smtp.gmail.com", 587)
Dim Credentials As New System.Net.NetworkCredential(senderID.Text, pass.Text)
client.Credentials = Credentials
client.EnableSsl = True
client.Send(msg)
Catch ex As Exception
MsgBox("Error sending email !!" & vbCrLf & ex.Message)
Exit Sub
End Try
MsgBox("Your email has been sent.")[/php]
Tested and working fine here
