• The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Sending mail with ASP.NET

Z

Zoltan

Guest
Hello,

I want to send a confirmation mail to my users. I'm using ASP.NET MVC 2 and this is my code:

var fromAddress = new MailAddress("admin@mydomain.com");
var toAddress = new MailAddress("example@gmail.com");
const string fromPassword = "xxxxxxxxx";
string subject = "test";
string body = "test text";
var smtp = new SmtpClient
{
Host = "mail.mydomain.com",
Port = 25,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(<a user account with administrator role created in plesk>, <the user's password>)
};
using (var message = new MailMessage(fromAddress, toAddress)
{
Subject = subject,
Body = body
})
{
smtp.Send(message);
}

But I receive this exception when executing the above code:
Bad sequence of commands. The server response was: This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server.

Thanks in advance
 
I have authenticated as you can see in my code:

Credentials = new NetworkCredential(<a user account with administrator role created in plesk>, <the user's password>)
 
What kind of mail Server used by SmtpClient class?
You are able to switch to this mail server: Home>Tools & Settings>Server Components>Select default Webmail component
 
Last edited:
Thank you for your help. The problem was in the settings of the SMTP server. It was configured to deny relay from any incoming IP!
I've found the solution here
 
Back
Top