• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Using ASP NET and mail.exe to Create Email Accounts / Mailboxes

P

petcoop05

Guest
I am trying to use mail.exe to create email accounts in ASP NET. If I run mail.exe through the command line on the server itself I can add an account. But when I run it through ASP NET (through c# in an ASPX file) nothing seems to happen, and the account is never created.

From what I can tell I think the command line is giving the following response when mail.exe is run form the ASPX file.

Error 5 at Connect to pipe: Access is denied.
at (vpipechannel::client::connect line 200)
at get shared instance of PleskSrvClient(PleskSrvClient::getInstance line 222)
at Unable to execute CU(wmain line 107)]

My first thought was the problem had something to do with having permission to run exe files. But this does not seem to be the problem.

The code is:

string exefile="c:\\Program Files\\swsoft\\plesk\\admin\\bin\\mail.exe";

System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(exefile);
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;

System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);

System.IO.StreamReader sOut = proc.StandardOutput;

string results = sOut.ReadToEnd().Trim();

sOut.Close();

Response.Write("["+ results.Replace(System.Environment.NewLine, "<br>") + "]");

I have tried using diffrent code, but I keep on getting the error. How do I create email accounts from ASP NET? Can I directly edit a database?

Thank You,

Nick Clark
 
as far as I know asp.net applications is run under application pool users (IWPD_someuser) , but I suppose that mail.exe should be run only by administrators.... try to add this appl pool user to addministrators group...
but in this case you'll get the hole in server security of course...
 
Back
Top