Hello i have used the code below to send e-mail on my website . But nowadays i got an error.
When i try to send from visual studio the code sends the e-mail.
But on the server (live) the process is too slow , and i don't receives any e-mail. Seems that the process is losing
Any advice? In advance thanks
Dim caminho As String = cryptocredentials.Crypto.Decrypt(dec.Mail)// My email from a dll
Dim valor As String = cryptocredentials.Crypto.Decrypt(dec.Acesso) // My password from a dll
Dim server As String = "smtp here"
Dim body As String = ("Mensagem enviada por: ")
body += String.Format(": {0},", Txtnome.Text.Trim())
body += String.Format(" " & "E-mail: {0},", Txtmail.Text.Trim())
body += String.Format(" " & "Assunto: {0},", Txttel.Text.Trim())
body += String.Format(" " & "Mensagem: {0},", Txtmessage.Text.Trim())
body += String.Format(" " & "Arquivos para análise: {0},", Txtlink.Text.Trim())
Dim Message As New Mail.MailMessage()
Message.From = New MailAddress(caminho)
Message.To.Add(caminho)
Message.Subject = "Contato"
Message.Body = body
Dim client As New SmtpClient(server)
client.Port = 587
client.EnableSsl = False
client.Credentials = New System.Net.NetworkCredential(caminho, valor)
Try
client.Send(Message)
Catch ex As Exception
ClientScript.RegisterStartupScript([GetType](), "alert", (Convert.ToString("alert('") & "Não foi possível enviar o e-mail.") + "');", True)
Finally
ClientScript.RegisterStartupScript([GetType](), "alert", (Convert.ToString("alert('") & "E-mail enviado com sucesso. Aguarde contato.") + "');", True)
Response.Redirect("http://www....")
End Try