Smtp Error after publishing

i have created a webpage to send an email after filling specific fields it’s working fine on my localhost but after publishing getting this error when click on submit
Server Error in ‘/’ Application.

*A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 173.194.76.109:587

Thank you

@Ahmed_Alsofi Welcome to UiPath forums.

Which smtp service are you using?
Which version of libraries are you using?
Have you checked if it could be a network / firewall related issue?

using asp.net with vb

  1. Dim mail As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()
  2. Dim strBody As String = ""
  3. mail.To.Add("Example@gmail.com")
  4. mail.From = New MailAddress("Example@gmail.com")
  5. mail.Subject = "New Booking"
  6. strBody = "<b>Name:</b>" & " " & FirstName.Text & " " & Middlename.Text & " " & Surname.Text & "<br><br>"
  7. strBody += "<b>Phone Number: </b>" & phone.Text & "<br><br>"
  8. strBody += "<b>Email: </b>" & txtEmail.Text & "<br><br>"
  9. strBody += "<b>Booking From: </b>" & " " & Bfrom.Text & " <b>at:</b>" & time1.Value & "<br><br>"
  10. strBody += "<b>Booking to: </b>" & " " & Bto.Text & " <b>at:</b>" & Time2.Value
  11. mail.Body = strBody
  12. mail.IsBodyHtml = True
  13. mail.Priority = Net.Mail.MailPriority.Normal
  14. Dim smtp As SmtpClient = New SmtpClient()
  15. smtp.Host = "smtp.gmail.com"
  16. smtp.Port = 587
  17. smtp.UseDefaultCredentials = True
  18. smtp.Credentials = New System.Net.NetworkCredential("Example@gmail.com", "password")
  19. smtp.EnableSsl = True
  20. smtp.Send(mail)
  21. smtp.DeliveryMethod = SmtpDeliveryMethod.Network
  22. lbltxt.Attributes("style") = "color:green;"
  23. Bto.Focus()
  24. lbltxt.Text = "Your Booking has been Successfully Sent"