I am trying to send a mail from admin@bitcoindk.dk to hejmeddig@gmail.com by doing this:
MailMessage mailObj = new MailMessage();
mailObj.From = new MailAddress("admin@bit.dk");
mailObj.To.Add("hejmeddig@gmail.com");
mailObj.Body = "HEJ";
mailObj.Subject = "HEJ";
SmtpClient SMTPServer = new SmtpClient();
SMTPServer.Send(mailObj);
In my web.config, i have this:
<system.net>
<mailSettings>
<smtp from="admin@bitcoindk.dk">
<network host="mail.bitcoindk.dk" port="25" userName="admin@bitcoindk.dk" password="password" />
</smtp>
</mailSettings>
</system.net>
When i send the mail, i get this exception
Transaction failed. The server response was: 5.7.1 <hejmeddig@gmail.com>: Relay access denied
If i send a mail to admin@bit.dk, it works fine. But if i send to hejmeddig@gmail.com, or any other mail, i get the exception. I am using Uno Euro's mail service.