Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Fala pessoal, beleza?
Gostaria de saber o que eu preciso TER para enviar e-mails, pois tentei vários sources e nada.
Quais informações preciso saber?
Abaixo segue o source e o erro:
Source:
'cria objeto com dados do e-mail Dim objEmail As New System.Net.Mail.MailMessage() 'remetente do e-mail objEmail.From = New System.Net.Mail.MailAddress("Andre <andre@sinoinformatica.com.br>") 'destinatários do e-mail objEmail.To.Add("Nome <andrebaltieri@hotmail.com>") objEmail.To.Add("Nome <fellnian@hotmail.com>") 'enviar cópia para objEmail.To.Add("Nome <fellnian@bol.com.br>") 'enviar cópia oculta para objEmail.Bcc.Add("Nome <andre.baltieri@itelefonica.com.br>") 'prioridade do e-mail objEmail.Priority = System.Net.Mail.MailPriority.Normal 'formato do e-mail HTML (caso não queira HTML alocar valor false) objEmail.IsBodyHtml = True 'título do e-mail objEmail.Subject = "título do e-mail" 'corpo do e-mail objEmail.Body = "Escreva aqui o seu <b>texto</b>" ' Para evitar problemas de caracteres "estranhos", configuramos o charset para "ISO-8859-1" objEmail.SubjectEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1") objEmail.BodyEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1") 'cria objeto com os dados do SMTP Dim objSmtp As New System.Net.Mail.SmtpClient 'alocamos o endereço do host para enviar os e-mails, localhost(recomendado) ou smtp2.locaweb.com.br objSmtp.Host = "smtp2.locaweb.com.br" objSmtp.UseDefaultCredentials = True objSmtp.Send(objEmail) 'enviamos o e-mail através do método .Send() 'Try 'objSmtp.Send(objEmail) 'Response.Write("E-mail enviado com sucesso !") 'Catch ex As Exception 'Response.Write("Ocorreram problemas no envio do e-mail. Error = " & ex.Message) 'End Try 'excluímos o objeto de e-mail da memória objEmail.Dispose()
Erro:
Server Error in '/EnviaEmail' Application.--------------------------------------------------------------------------------Unable to read data from the transport connection: net_io_connectionclosed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IO.IOException: Unable to read data from the transport connection: net_io_connectionclosed.Source Error: The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:1. Add a "Debug=true" directive at the top of the file that generated the error. Example: <%@ Page Language="C#" Debug="true" %>or:2) Add the following section to the configuration file of your application:<configuration> <system.web> <compilation debug="true"/> </system.web></configuration>Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario. Stack Trace: [IOException: Unable to read data from the transport connection: net_io_connectionclosed.] System.Net.Mail.SmtpReplyReaderFactory.ProcessRead(Byte[] buffer, Int32 offset, Int32 read, Boolean readLine) +526 System.Net.Mail.SmtpReplyReaderFactory.ReadLines(SmtpReplyReader caller, Boolean oneLine) +256 System.Net.Mail.SmtpReplyReaderFactory.ReadLine(SmtpReplyReader caller) +27 System.Net.Mail.SmtpReplyReader.ReadLine() +14 System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +756 System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +265 System.Net.Mail.SmtpClient.GetConnection() +43 System.Net.Mail.SmtpClient.Send(MailMessage message) +1441[SmtpException: Failure sending mail.] System.Net.Mail.SmtpClient.Send(MailMessage message) +2039 _Default.Page_Load(Object sender, EventArgs e) +330 System.Web.UI.Control.OnLoad(EventArgs e) +80 System.Web.UI.Control.LoadRecursive() +49 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3743 --------------------------------------------------------------------------------Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42Se alguém puder ajudar, seria mto grato :(
Carregando comentários...