473,748 Members | 6,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating pop3 accounts through c# asp.net

4 New Member
Hello all, I have been on a quest to setup email accounts through the code behind on one of my asp.net pages. I am using the process class to call the command line that creates the user:

"c:\windows\sys tem32\winpop.ex e add user@domain.com /CREATEUSER password"

I do not get an error on screen, but the account is never created and i get an error in my event viewer:

"Applicatio n popup: winpop.exe - Application Error : The application failed to initialize properly (0xc0000142). Click on OK to terminate the application."

This is the code I am using right now:

Expand|Select|Wrap|Line Numbers
  1. Process proc = new Process();
  2.             System.Security.SecureString ss = new System.Security.SecureString();
  3.             ss.AppendChar('P');
  4.             ss.AppendChar('A');
  5.             ss.AppendChar('S');
  6.             ss.AppendChar('S');
  7.             ss.AppendChar('W');
  8.             ss.AppendChar('O');
  9.             ss.AppendChar('R');
  10.             ss.AppendChar('D');
  11.             proc.StartInfo.FileName = @"C:\windows\system32\winpop.exe";
  12.             proc.StartInfo.Arguments = "add user@domain.com /CREATEUSER password";
  13.             proc.StartInfo.UserName = "USERNAME";
  14.             proc.StartInfo.Password = ss;
  15.             proc.StartInfo.UseShellExecute = false;
  16.             proc.StartInfo.RedirectStandardOutput = true;
  17.             proc.Start();
When I attempt to read the output it just hangs my script.. I would appreciate any pointers anyone might have!
Jason
Jan 29 '08 #1
4 3557
box86rowh
4 New Member
Please, if somebody has any insight, please help!

I think my issue might have soemthing to do with passing the user name and password into the process..it only seems to lock if i do that. Of course if I dont pass it, I get access denied.

I have tried running a dir with the process which works great with no auth, but when I add the user/pass it crashes.

I would appreciate some help!
Thanks in advance,
Jason
Jan 30 '08 #2
box86rowh
4 New Member
OK, using this VB code:

Expand|Select|Wrap|Line Numbers
  1. Dim oConfig, oUsers
  2.         oConfig = System.Web.HttpContext.Current.Server.CreateObject("P3Admin.P3Config")
  3.         oUsers = oConfig.Domains.Item(domain).Users
  4.         Call oUsers.AddEx(user, password)
It adds the user as expected, however I cannot get the c# equivelent of the code to function. And when i compile this into a vb class dll and use it in my c# I get a parameter error....this is very frustrating!
Jan 30 '08 #3
box86rowh
4 New Member
Bump....

....
....
.....
....
Jan 30 '08 #4
foicanetadavo
1 New Member
Hello! I've started to use P3AdminLib now, and I only can list users, I couldn't create and delete mailboxes yet, keeps giving me "access denied". My C# code is the following:

public static DataTable getMailboxes()
{
DataTable dt = new DataTable("Mail boxes");
DataRow dr;
dt.Columns.Add( "Mailbox");
dt.Columns.Add( "DiskUsage" );
dt.Columns.Add( "Messages") ;
int plFactor = 0;
double usage = 0.0;

try
{
P3ADMINLib.P3Co nfig P3 = new P3ADMINLib.P3Co nfig();
P3ADMINLib.P3Do main domain = P3.Domains.get_ Item(0);
P3ADMINLib.P3Us ers users = domain.Users;

foreach (P3ADMINLib.P3U ser user in users)
{
dr = dt.NewRow();
dr["Mailbox"] = user.EmailName;
usage = Math.Round((dou ble)(user.get_M essageDiskUsage (out plFactor)) / 1024.0);
dr["DiskUsage"] = usage.ToString( )+"KB";
dr["Messages"] = user.MessageCou nt;
dt.Rows.Add(dr) ;
}
}
catch (Exception exc)
{
LogRegister.Log Register log = new LogRegister.Log Register("Utils .cs", exc.Message, new StackTrace(0, true).GetFrame( 0).GetMethod(). Name, "System", true);
return dt;
}
return dt;
}

public static bool createMailbox(s tring Mailbox)
{
bool created = false;

try
{
P3ADMINLib.P3Co nfig P3 = new P3ADMINLib.P3Co nfig();
P3ADMINLib.P3Do main domain = P3.Domains.get_ Item(0);
domain.Users.Ad d(Mailbox);
created = true;
}
catch (Exception exc)
{
LogRegister.Log Register log = new LogRegister.Log Register("Utils .cs", exc.Message, new StackTrace(0, true).GetFrame( 0).GetMethod(). Name, "System", true);
}
return created;
}

public static bool deleteMailbox(s tring Mailbox)
{
bool deleted = false;

try
{
P3ADMINLib.P3Co nfig P3 = new P3ADMINLib.P3Co nfig();
P3ADMINLib.P3Do main domain = P3.Domains.get_ Item(0);
P3ADMINLib.P3Us ers users = domain.Users;

foreach (P3ADMINLib.P3U ser user in users)
{
if (user.EmailName == Mailbox)
{
domain.Users.Re move(user.Name) ;
break;
}
}
deleted = true;
}
catch (Exception exc)
{
LogRegister.Log Register log = new LogRegister.Log Register("Utils .cs", exc.Message, new StackTrace(0, true).GetFrame( 0).GetMethod(). Name, "System", true);
}
return deleted;
}

Can anyone tell me how to pass the "access denied" problem? If not, hope you enjoy C# for P3AdminLib.
Apr 10 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
5958
by: Lev Altshuler | last post by:
Hi, I am trying to count email messages in the mailbox and read their headers. In case that there are some messages on the POP3 server and they haven't yet got to the Inbox, I get a number of messages. As soon as they have been in the Inbox, I get '0E0' as a number of messages. Does anyone know what feature of Net::POP3 I am not aware of, or where did I screw up in the code? use Net::POP3;
0
2607
by: Eric McDaniel | last post by:
This may be a question for ActiveState support, but just in case anyone out there knows what the problem is... My call to Net::POP3->new() works fine when run through the perl interpreter, but fails when I compile the script with PerlApp and run it. My system is Windows 2000, ActiveState Perl 5.8.0 build 806, PerlApp 5.2.0 build 520. Here is the script:
3
2880
by: Chad Myers | last post by:
I'm looking for an app that would allow me to download mails from various POP3 accounts and put them into my Exchange inbox on the server side (rather than having to have outlook open to do it all the time). There are many products that do this, but they're very expensive considering it's just for me and just for tinkering.
2
4475
by: Kevin Beyers | last post by:
Hello Everyone. I am in the process of writing an Internet connection wizard program for the company I am working for. At present, I have all the pieces together beside the part of setting the email account password for outlook. If anyone have any ideas that could help. Please let me know Currently I have found the following info HKEY_CURRENT_USER\Software\Microsoft\Internet Account Manager\Accounts\00000007
3
3121
by: Carlos Lozano | last post by:
Hi, I know I can create e-mails and send them using System.Web.Mail, but I was wondering how can I do it using the POP3 settings on Office Outlook or Outlook Express. The problem I have is some users are being denied access to relying directly to the smtp server, but they can send using outlook's POP3 settings. Thanks,
2
2833
by: Mike Brearley | last post by:
I need to write a script that will check a catch-all mailbox (pop3) and send a non delivery report back to the sender of the email. Background info: I have a domain hosted on a site that offers unlimited email accounts... the problem is, emails sent to an invalid address on the domain aren't automatically returned as non-deliverable. I am, however, able to set up a catch-all address and able to pick up those emails. Id like to set up a...
0
939
by: Mads Westen | last post by:
Hi, I got my code to work on exchange accounts. Is it possible to write some code that add's appointments in the account on pop3 accounts in Outlook? Best regards Mads
0
3438
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails to a PDA/palmtop via POP3. The PDA uses Windows Mobile software. Since using the PDA, I have had the problem of emails disappearing from the Yahoo! server. However I think I now understand how to avoid this. It seems that Windows Mobile is...
5
2674
by: Craig Buchanan | last post by:
I would like to monitor a POP3 mailbox with multiple clients. However, I want to ensure that each message is processed by only one client. In essence, I would like to treat a POP3 mailbox like a queue. From what I've read thus far, atomic message access (if this is the right term) isn't a native feature of the POP3 protocol. Am I mistaken? My approach thus far, is to have one thread connect to the mailbox periodically, look for new...
0
8826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8239
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.