locked
Problem with sending email RRS feed

  • Question

  • User364803292 posted

    Hello all

    I have a contact form in my web site but i keep getting an error when trying to send the email.

    This is the error:

    Transaction failed. The server response was: 5.7.1 <myEmail@myDomain.com>: Relay access denied

    This is the code I use:

    MailMessage message = new MailMessage();
    
                    message.To.Add(new MailAddress(ConfigManager.GetValue("ToEmail")));
                    message.Subject = "From " + tbName.Text.ToUpper() + ", company " + tbComapnyName.Text.ToUpper() + " - Contact Form";
                    string textMessage = tbTel.Text + "<br>" + tbMessage.Text.ToUpper();
                    message.IsBodyHtml = true;
                    message.Sender = new MailAddress(tbEmail.Text.ToUpper());
                    message.Body = textMessage.ToUpper();
    
                    SmtpClient client = new SmtpClient();
                    client.Send(message);
    
    
      <appSettings>
        <add key="ToEmail" value="myEmail@myDomain.com" />
      </appSettings>
    
    <mailSettings>
          <smtp deliveryMethod="Network" from="myEmail@myDomain.com">
            <network host="mail.myDomain.com" password="myPassword" userName="myUserName"/>
          </smtp>
        </mailSettings>
    
    

    I also have an asp:CreateUserWizard that send an email that gets the message from a text file which works fine :S. This is part of the code of the createUserWizzard:

    .

    ..

    ...

    ....                 

      </WizardSteps>

        <MailDefinition BodyFileName="~/Texts/RegistrationMail.txt" From="myEmail@myDomain.com"

          Subject="Email subject">

        </MailDefinition>

    </asp:CreateUserWizard>

    Tuesday, August 23, 2011 8:42 AM

Answers

  • User364803292 posted

    This was an error of my email provider. I contacted them and they fixed.

    The code I posted works fine.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 24, 2011 8:42 AM

All replies

  • User-1315512054 posted

    Hello,

    You can test your mail server by typing in command promt "telnet yourmailserver.com 25" (port 25 is the default SMTP port).

    Regards

    Tuesday, August 23, 2011 8:59 AM
  • User364803292 posted

    Hello hostingASPNet

    thank you for your time

    i typed what you said to cmd and I got this:

    220 win32.grserver ESMTP

    but I have no idea what that means

    Tuesday, August 23, 2011 9:34 AM
  • User364803292 posted

    This was an error of my email provider. I contacted them and they fixed.

    The code I posted works fine.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, August 24, 2011 8:42 AM