I'm trying to put together a code for sending email on my page. No error occurs, but I also do not receive the email. Could anyone tell me 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>