0
I am trying to assemble a code for sending email on my page. No error occurs, but I also do not receive the email. Would anyone know why?
Default.aspx.Vb
Protected Sub btnEnviar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnEnviar.Click
Dim Mensagem As MailMessage = New MailMessage()
Dim Email As New SmtpClient()
Dim basicAuthenticationInfo As New System.Net.NetworkCredential("[email protected]", "password", "smtp.jnmoura.com.br")
Email.Host = "smtp.jnmoura.com.br"
Email.Port = 587
Email.EnableSsl = False
Email.UseDefaultCredentials = True
Email.Credentials = basicAuthenticationInfo
Email.DeliveryMethod = SmtpDeliveryMethod.Network
Mensagem.From = New MailAddress("[email protected]")
Mensagem.To.Add(New MailAddress("[email protected]"))
Mensagem.To.Add("[email protected]")
Mensagem.Subject = "Teste de envio de email"
Mensagem.Body = "TESTE"
Mensagem.IsBodyHtml = False
Mensagem.Priority = MailPriority.High
Email.Send(Mensagem)
End Sub
Web.config
<system.net>
<mailSettings>
<smtp>
<network
host="smtp.jnmoura.com.br"
port="587"
userName="[email protected]"
password="password"
enableSsl="true"
/>
</smtp>
</mailSettings>
Could explain what was wrong and what changed in the guy’s code...
– CypherPotato
First I cleaned the excess code (unused). I practically changed the enableSsl from true to false in web.config and left a fixed email in Default.aspx.Vb’s Message.From
– Rodrigo Cichetto