Parsing large. NET ERP System account integration for e-mail systems

Source: Internet
Author: User
Tags administrator password mail account

In order to ensure the accurate and fast transmission of the information flow in ERP system, a message box mechanism is needed for the system design. When business operations occur in the system, it is necessary to remind the operators of the next link to ensure the rapid and accurate transmission of the ERP information flow. such as production task orders (work orders, processing orders, orders) after the completion of the post, you need to inform the warehouse preparation materials for the workshop picking material production. The interface of the message box is as follows:

The message box contains business notifications (Messages) and workflow Approvals (Workflow). Business notifications such as when a purchase order PO is issued by a purchaser, the warehouse personnel need to be notified to prepare the receipt. Workflow approval is a document process control based on approval.

In the implementation of the message box process, encountered a customer needs to send the message to the e-mail system, so wrote this article to share the implementation process.

The purpose of the customer is simple, and the message is sent to the appropriate mail account as well:

Implement part 1 to build an email server

There are several options:

1 mail server with Outlook Exchange Server is a good mail server, but the configuration is slightly more complicated.

2 Magic winmail, Winwebmail Free Edition can publish 50-100 accounts, exceeding this limit requires purchase authorization.

3 hMailServer Open Source, free, unlimited. A COM interface is available for two development.

Finally choose hMailServer as the mail server of ERP system. The configuration process is skipped here.

After installing hMailServer, create the domain name and enable it.

2 Synchronizing account messages

Open the Synchronizer, as shown in, and then connect to the mail server after you enter the administrator password. This is the program that I called the COM interface to complete.

In this program, the ERP user's mail can be synced to the hMailServer account table.

Click the Sync button, open the ERP account selection form, and then click Confirm, the account in the ERP is synced to the hMailServer mail system.

To view hMailServer's account:

Development section

Here is a detailed explanation of how the above synchronization program is implemented, it is a simple C # call C + + COM interface program. hMailServer officially given the address of the COM Help document here: Https://

1 Read mail SYSTEM account

Create a connection to the Hmailsever server first

Private Domain hmailserverconnection ()
   string hmaildomain = Txtdomain.text;
   string Hmailusername = "Administrator";
   string Hmailpassword = txtPassword.Text;
   New ApplicationClass ();
   Objglobal.authenticate (Hmailusername, Hmailpassword);
   return objGlobal.Domains.get_ItemByName (hmaildomain);

Most of the time we interact with the interface object domain.

Then read the Account table data bound in the interface grid control.

New DataTable ("Table");
Table. Columns.Add ("Addresstypeof (string)");
Table. Columns.Add ("Passwordtypeof (string)");
Table. Columns.Add ("personfirstnametypeof (string)");
Table. Columns.Add ("personlastnametypeof (string)");
_domain = Hmailserverconnection ();
Accounts Accounts = _domain. Accounts;
 for (int i = 0; i < accounts. Count; i++)
      Account account = Accounts[i];
      DataRow datarow = table. NewRow ();
      datarow["Address" = account. Address;
      datarow["Password"] = account. Password;
      datarow["personfirstname"] = account. Personfirstname;
      datarow["personlastname"] = account. Personlastname;
      Table. Rows.Add (DataRow);
Gridaccount.datasource = table;

2 Adding mail accounts

Refer to the following code call

Domain domain = hmailserverconnection ();
Accounts Accounts = domain. Accounts;
Account mailbox = accounts. ADD ();
Mailbox. Address = email;
Mailbox. Password = Password;
Mailbox. Save ();

3 Clearing mail accounts

Refer to the following code

Accounts Accounts = _domain. Accounts;
int count = accounts. Count;
 while (Count > 0)
      _domain. Accounts.delete (0);
_domain. Accounts.refresh ();

The COM interface provided by Hmailsever is x86 architecture, so I can only set the x86 compiler platform for this project.

4 Multi-lingual

This project also involves multi-language implementations, and I'm using a common method of translating the controls on the interface, referring to the following code.

 Public Static void Translateform (Form form)
    string string. Empty;
    string string. Empty;
    Switch (Application.CurrentCulture.LCID)
          Case 2052:
             Translation = "CHS";
          Case 1028:
          Case 3076:
          Case 5124:
                 Translation = "CHT";
foreach inch Getallcontrolsrecusrvive<label> (Form))
    LabelText = label. Text.trim (). TrimEnd (': ');
    DataRow = Shared.TranslationTable.Rows.Find (LabelText);
    if null)
        Label. Text = convert.tostring (Datarow[translation]);

I just need to call the method above in the form-loading event of each interface to complete the multilanguage feature.

protected Override void OnLoad (EventArgs e)
    base. OnLoad (e);
    Shared.translateform (this);

The interface translation is derived from the XML resource file embedded in the project.

Project source code file: Http://

Parsing large. NET ERP System account integration for e-mail systems

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.