Jump to content
Fórum Script Brasil
  • 0

Erro no envio de email


Sérgio Toledo

Question

Olá a todos,

Estou com um sistema pronto que após o cadastro envia um email de confirmação, porém o sistema está apresentando o erro abaixo:

http://awesomescreenshot.com/01elpyza4

A conta SMTP utilizada para o envio já foi criada e está funcionando normalmente.

Já verifiquei as configurações mas não sei onde está o erro.

Toda ajuda será bem vinda.

a parte do código que envia o email:

private void EnviarEmail(string pDestinatario, string pAssunto, string pEmail)
    {
        SmtpClient mail = new SmtpClient();

        mail.Host = ConfigurationManager.AppSettings["email.servidor.endereco"];
        mail.Port = int.Parse(ConfigurationManager.AppSettings["email.servidor.porta"]);
        mail.DeliveryMethod = SmtpDeliveryMethod.Network;
        mail.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["email.usuario"],
            ConfigurationManager.AppSettings["email.senha"]);

        MailAddress remetente = new MailAddress(ConfigurationManager.AppSettings["email.usuario"], ConfigurationManager.AppSettings["email.remetente.nome"]);
        MailAddress destinatario = new MailAddress(pDestinatario);
        MailMessage message = new MailMessage(remetente, destinatario);
        message.Subject = pAssunto;
        message.Body = pEmail;
        message.IsBodyHtml = true;

        mail.Send(message);
    }

Grande abraço.

Edited by Sérgio Toledo
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Pessoal, segue também o web.config

O problema pode estar nele também.

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="webpages:Version" value="1.0"/>
    <add key="email.servidor.endereco" value="mail.allerganmedical.com.br"/>
    <add key="email.servidor.porta" value="25"/>
    <add key="email.usuario" value="contato@allerganmedical.com.br"/>
    <add key="email.senha" value="***"/>
    <add key="email.remetente" value="contato@allerganmedical.com.br"/>
    <add key="email.remetente.nome" value="Convenção Allergan Medical"/>
  </appSettings>
  <connectionStrings>
    <add name="MySql" connectionString="server=***;user id=***;password=***;database=***;" providerName="MySql.Data.MySqlClient"/>
    <add name="MySql.prd" connectionString="server=***;user id=***;password=***;database=***;" providerName="MySql.Data.MySqlClient"/>
  </connectionStrings>
  <system.web>
    <!--<trust level="Full"/>-->
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="MySql.Data, Version=5.2.5.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
      </assemblies>
    </compilation>
    <roleManager defaultProvider="Permissionamentos" enabled="true" cacheRolesInCookie="true" cookieName=".Pb0t0ks2010" cookieTimeout="10" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
      <providers>
        <clear/>
        <add name="Permissionamentos" type="Permissionamentos"/>
      </providers>
    </roleManager>
    <authentication mode="Forms">
      <forms name=".b0t0ks2012" loginUrl="~/Login.aspx" timeout="10"/>
    </authentication>
    <customErrors mode="Off" defaultRedirect="Erro.aspx"/>
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
  <!-- 
    The system.webServer section is required for running ASP.NET AJAX under Internet
    Information Services 7.0.  It is not necessary for previous version of IIS.
  -->
  <!-- PERMISSIONAMENTO ADMIN -->
  <system.web>
    <authorization>
      <allow roles="admin"/>
      <deny users="*"/>
    </authorization>
  </system.web>
  <location path="Login.aspx">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="res">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
  <location path="emails">
    <system.web>
      <authorization>
        <allow users="*"/>
      </authorization>
    </system.web>
  </location>
</configuration>

Edited by Sérgio Toledo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...