Hello i am having some problems sending mails thoug my site.
I keep getting the error
The SMTP server requires a secure connection or the client was not authenticated. The server response was: SMTP authentication is required.
My Web.config have
<system.net>
<mailSettings>
<smtp from="[email protected]">
<network host="mail.XXXXX.XX" port="25" userName="[email protected]" password="XXXXXXXX" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
And my code
MailMessage message = new MailMessage();
message.From = new MailAddress("[email protected]");
message.To.Add(new MailAddress(split[0]));
message.Subject = split[1];
message.Body = ContactUsBody(model);
message.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Send(message);
It throws the error on client.Send(message), i think that for some reason it dose not use the password and username from the config. I have tried logging on to the email account though thunderbird and have no problems sending or receiving mails there. What am i doing wrong here?