Problema no envio de e-mail!
25/02/2008
0
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net.Mail; public partial class contato : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { statusLabel.Text = "TesteLabel!"; } protected void enviarButton_Click(object sender, EventArgs e) { MailMessage mail = new MailMessage(emailTextBox.Text, "hnkarla@gmail.com", "Contato - Rodotruck", mensagemTextBox.Text); SmtpClient client = new SmtpClient("localhost"); try { client.Send(mail); statusLabel.Text = "Mensagem Enviada com Sucesso!"; Response.Write("Msg Enviada"); } catch (Exception erro) { statusLabel.Text = "Falha ao enviar mensagem!"; Response.Write(erro); } finally { mail.Dispose(); } } }
Tá dando mensgem enviada, mas não recebo nada! Já configurei o IIS, acho q está certo.. pq antes já caia na excpetion ali ´System.Net.Mail.SmtpFailedRecipientException´, mas ai mexei na configuraçao e agora dá msg enviada, mas n envia, se vcs puderem me ajudar eu agradeço =]
Obrigada!
[/b:c5ef67e6b2]
Hnkarla
Posts
26/02/2008
Hnkarla
Onde posso saber se ele requer autorização?
26/02/2008
Hnkarla
e olha o qq deu
System.Net.Mail.SmtpException: Falha ao enviar email. ---> System.Net.WebException: Impossível conectar-se ao servidor remoto ---> System.Net.Sockets.SocketException: Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente em System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) em System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) em System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) --- Fim do rastreamento de pilha de exceções internas --- em System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) em System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) em System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) em System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) em System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) em System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) em System.Net.Mail.SmtpClient.GetConnection() em System.Net.Mail.SmtpClient.Send(MailMessage message) --- Fim do rastreamento de pilha
me ajudem!!
26/02/2008
Hnkarla
26/02/2008
Massuda
Se você estiver testando na sua máquina, além do servidor web (HTTP), você precisa estar rodando também um servidor SMTP.
Clique aqui para fazer login e interagir na Comunidade :)