Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Henrik Sunesen 84 posts 281 karma points
    Mar 05, 2019 @ 17:40
    Henrik Sunesen
    0

    Unoeuro / C# / Umbraco SMTP problem

    Hello all,

    I know this is more like a c#/unoeuro problem but i will try anyway.

    When i try to send email from my page nothing happens, it works fine on localhost but not on unoeuro. Here is my code:

     var smtpServer = new SmtpClient("asmtp.unoeuro.com", 587)
            {
                Credentials = new NetworkCredential("----", "----"),
                EnableSsl = true
            };
    
            try
            {
                MailAddress from = new MailAddress("------");
                MailAddress to = new MailAddress("------");
    
                MailMessage mailMessage = new MailMessage(from, to);
    
                mailMessage.Subject = ""          
                mailMessage.IsBodyHtml = true;
                mailMessage.Body = ""
                mailMessage.ReplyToList.Add(---);
                smtpServer.Send(mailMessage);
            }
            catch (Exception)
            {
                throw;          
            }
    
        }
    

    Earlier today I got this error:

    Transaction failed. The server response was: 5.7.1 <nt34.unoeuro.com[93.191.156.17]>: Client host rejected: Relay from servers and automated mails are not allowed, use smtp.unoeuro.com instead - For help see https://unoeuro.com/support/?s=asmtp.unoeuro.com
    

    But i still can't find any solution, I have tried to change it from asmtp to smtp but with no luck.

    Hope someone has an idea of a solution :)

  • Søren Kottal 712 posts 4570 karma points MVP 6x c-trib
    Mar 05, 2019 @ 19:38
    Søren Kottal
    0

    Hi Henrik

    You need to use port 587 when using smtp.unoeuro.com. https://en.unoeuro.com/support/faq/mail/606/

      <system.net>
        <mailSettings>
          <smtp from="[email protected]">
            <network host="smtp.unoeuro.com" port="587" enableSsl="true" />
          </smtp>
        </mailSettings>
      </system.net>
    
  • Henrik Sunesen 84 posts 281 karma points
    Mar 05, 2019 @ 20:07
    Henrik Sunesen
    0

    Hi Søren

    Thanks for the advice, I have now tried to add the following to my web.config:

    <mailSettings>
    <smtp from="---@---">
        <network host="smtp.unoeuro.com" port="587" enableSsl="true" userName="--@--" password="--" />
      </smtp>
    </mailSettings> 
    

    And that does not help :/

  • Ole Martin Bakke 112 posts 624 karma points
    Mar 05, 2019 @ 20:53
    Ole Martin Bakke
    0

    Have you also changed var smtpServer = new SmtpClient("asmtp.unoeuro.com", 587)

    To var smtpServer = new SmtpClient("smtp.unoeuro.com", 587)

  • Henrik Sunesen 84 posts 281 karma points
    Mar 05, 2019 @ 21:03
    Henrik Sunesen
    0

    Yes :/

  • Ole Martin Bakke 112 posts 624 karma points
    Mar 05, 2019 @ 21:08
    Ole Martin Bakke
    0

    Do you get the same error on both smtp and asmtp?

  • Henrik Sunesen 84 posts 281 karma points
    Mar 05, 2019 @ 21:43
    Henrik Sunesen
    0

    Yes, the error has not been effected by changing from asmtp to smtp...

  • Henrik Sunesen 84 posts 281 karma points
    Mar 06, 2019 @ 16:37
    Henrik Sunesen
    0

    All my controllers are located in an folder called "controller" is this okay? or do they need to be located in app_code?

    I just tried to use Google smtp that doesn't work eigther...

Please Sign in or register to post replies

Write your reply to:

Draft