Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

asp.net

Problemas com email na minha máquina

Recommended Posts

Galera bom dia,

 

Estou com um grande problema que é exatamente testar o codigo de envio de email na minha máquina, tenho o código abaixo:

 

::::::::::::::::::::codigo::::::::::::::::::::::::::::::::::::::::::::::::::::::

:::

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>

<%@ Import namespace="System.Web.Mail"%>

<html>

<head>

<title>LRC Construtora - LTDA.</title>

<link href="css/texto.css" rel="stylesheet" type="text/css">

<script runat="server">

Sub Enviaemail(obj as object, e as eventargs)

Dim mensagem as String ' Aqui estou criando um novo objeto

Dim email as String

 

mensagem +="Contato para construtora LRC<br>"

mensagem +="Nome do contato:"+nome.text

 

Dim objEmail as New MailMessage

email = "Construtora LRC LTDA. (guilherme.carneiro@uol.com.br)"

with objEmail

.To=email

'.BCC="macoratti@yahoo.com"

.FROM="macoratti@pop.com.br"

.SUBJECT="Contato."

.BODY=mensagem

.BodyFormat = MailFormat.HTML

'.SmtpServer = smtp.localweb.com.br

end with

SmtpMail.Send(objEmail)

'Err.Raise(Err.Number, Err.Source, ex.Message)

response.Redirect("www.uol.com.br")

end sub

</script>

........

 

<form runat="server" action="enviando.aspx">

<table width="90%" border="0" cellspacing="0">

<tr align="left">

<td width="22%">Nome:</td>

<td width="78%"><asp:TextBox runat="server" ID="nome"></asp:TextBox></td>

</tr>

<tr align="left">

<td>Telefone:</td>

<td><asp:TextBox runat="server"

ID="telefone"></asp:TextBox></td>

</tr>

<tr align="left">

<td>Assunto</td>

<td><asp:TextBox runat="server"

ID="assunto"></asp:TextBox></td>

</tr>

<tr align="left">

<td valign="top">Mensagem</td>

<td><asp:TextBox runat="server" ID="mensagem"

Width="15" Height="25" TextMode="MultiLine"></asp:TextBox></td>

</tr>

<tr align="left">

<td valign="top" class="style2"><asp:Button

runat="server" ID="Enviando" Text="Enviar"

OnClick="Enviaemail"></asp:Button></td>

<td> </td>

</tr>

</table>

</form>

 

Quando eu mando para o servidor funciona normalmente, quando eu tento rodar aqui na minha máquina dá erro:

 

Server Error in '/lrc' Application.

O valor de configuração "SendUsing" é inválido.

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.Runtime.InteropServices.COMException: O

valor de configuração "SendUsing" é inválido.

 

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:

 

[COMException (0x80040220): O valor de configuração "SendUsing" é inválido.

]

 

[TargetInvocationException: Exception has been thrown by the target of

an invocation.]

System.RuntimeType.InvokeDispMethod(String name, BindingFlags

invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,

Int32 culture, String[] namedParameters) +0

System.RuntimeType.InvokeMember(String name, BindingFlags

invokeAttr, Binder binder, Object target, Object[] args,

ParameterModifier[] modifiers, CultureInfo culture, String[]

namedParameters) +473

System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String

methodName, Object[] args) +58

 

[HttpException (0x80004005): Could not access 'CDO.Message' object.]

System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String

methodName, Object[] args) +112

System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1840

System.Web.Mail.SmtpMail.Send(MailMessage message) +153

ASP.contato_aspx.Enviaemail(Object obj, EventArgs e) +136

System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBa

ckEvent(String

eventArgument) +57

System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler

sourceControl, String eventArgument) +18

System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33

System.Web.UI.Page.ProcessRequestMain() +1277

 

Version Information: Microsoft .NET Framework Version:1.1.4322.573;

ASP.NET Version:1.1.4322.573

:::::::::::::::fim do

erro:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

Ai eu entrei num site e verifiquei que ele manda colocar o parametro

SmtpMail.SmtpServer="localhost"

 

eu já fiz isto mas continua não mandando, então eu habilitei o serviço de smtp, e agora o erro que estou tendo é o seguinte.

 

Server Error in '/' Application.

O servidor rejeitou um ou mais endereços de destinatário. A resposta do servidor foi: 550 5.7.1 Unable to relay for vendas@toyotapb.com.br

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.Runtime.InteropServices.COMException: O servidor rejeitou um ou mais endereços de destinatário. A resposta do servidor foi: 550 5.7.1 Unable to relay for vendas@toyotapb.com.br

 

O que seria agora?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara,você utiliza algum anti-vírus?Pois tive problemas assim na minha máquina. Refiz mil vezes o meu código, quando fui ver, o anti-vírus estava bloqueando acesso a porta 25 da minha máquina. eheheheheheh Estou usando McCafee VirusScan.Espero que ajude,[]´s

Compartilhar este post


Link para o post
Compartilhar em outros sites

Pra te falar a a verdade eu estou usando tanto anti virus como firewall.No caso o antivirus é o Norton e o Firewall é o seagete personal firewall.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Pode ser alguma configuração de um dos dois programas.Neste caso você teria que tentar descobrir nesses programas se há algo bloqueando a utilização da porta 25.[]´s

Compartilhar este post


Link para o post
Compartilhar em outros sites

Cara olha só eu fiz o seguinte, abri o firewall e chamei a aplicação, ai ele me perguntou se poderia liberar o serviço eu disse que sim,e neste caso ele me trouxea seguinte mensagem.

 

Falha na conexão do transporte com o servidor.

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.Runtime.InteropServices.COMException: Falha na conexão do transporte com o servidor.

 

Source Error:

 

Line 19: end with

Line 20: SmtpMail.SmtpServer="smtp2.locaweb.com.br"

Line 21: SmtpMail.Send(objEmail)

Line 22: response.Redirect("ok.aspx?pg=1&s=1")

 

e a linha 21 marcada, ainda assim deve ser algum dos dois programas né isto? Como você resolveu a bronca?

Compartilhar este post


Link para o post
Compartilhar em outros sites

No meu caso foi simples, meu VirusScan tem uma tela que mostra todas as portas em uso na máquina e se está bloqueada ou não. Simplemente tirei o bloqueio da porta.[]´s

Compartilhar este post


Link para o post
Compartilhar em outros sites

Acho que estou ficando louco, porque quando cheguei em casa e fui rodar novamente o código, deu o seguinte erro.

 

 

Server Error in '/' Application.

O servidor rejeitou um ou mais endereços de destinatário. A resposta do servidor foi: 550 5.7.1 Unable to relay for guilherme.carvalho@netcars.com.br

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.Runtime.InteropServices.COMException: O servidor rejeitou um ou mais endereços de destinatário. A resposta do servidor foi: 550 5.7.1 Unable to relay for guilherme.carvalho@netcars.com.br

 

Source Error:

 

Line 20: end with

Line 21: SmtpMail.SmtpServer="phabrica"

Line 22: SmtpMail.Send(objEmail)

Line 23: response.Redirect("ok.aspx?pg=1&s=1")

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom para aqueles que me ajudaram e acompanharam este tópico ai vai a respota para a bronca. Basta entrar no IIS na parte do Serviço do SMTP, botão direito do mouse, opção Acesso » Retransmitir » Marcar a opção Todos exceto a lista abaixo, clique em aplicar, ok e pronto está liberado o envio de email via asp.net no windows 2003.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.