Email email in PB applications

zhaozj2021-02-08  221

Receiving emails in PB applications ---- With the Internet enters thousands of households, it will become one of the most welcoming communication furnitures through the Internet. If our applications, our applications can also provide the ability to collect email messages, allow our part to exchange and share applicable data and information quickly, so that it should be used to be truly dissolved in the Internet. Next, I will introduce the method of real generating electronics mail in Powerbuild. ---- In PowerBuild, you should realize the generator mail, and the main thing is a set of embedded functions for mailing through the PowerBuild system. These functions are implemented in the interface between Micro-soft MAPI (Message Application Program Interface). ---- First, as an example, create an MDI style window W_mail. On this window, put a menu M_mail containing a menu item containing the pickup, sending the mail and the site, and a multi-line editor MLE_1. The outer view of the entire window is as follows: ---- [图] ---- Two, for each menu item (EVENT), Script. In the order of the order, it is the words of the text. ---- 1. Enter the next program under the click "Clickcked" click-by-click click.

Mailsession MSES

File: // Define the object MSES for reference to the program

MailMessage MMSG

/ / Define the structure MMSG, this structure is used to describe the content of the message

MailRecipient MREC

/ / Define the structure MREC, which identifies the recipient and sender of the message

MailreturNCode Mreturn

/ / Define the return code to store the return value of the function

int mnbr

// Define a temporary variable

// Generate a message session object MSES

MSES = CREATE MAILSession

// mail login. This username, password default

MRETURN = mses.maillogon (MailneWSession!)

IF MRETURN <> mailreturnsuccess! then

MessageBox ("Mail Login", "Mail Login Failed!")

Return

END IF

// Get the received mail ID number that has not been read.

It is a string array in MSES

MRETURN = mses.mailgetMersses (TRUE)

IF MRETURN <> mailreturnsuccess! then

MessageBox ("Mail Get", "Mail gets failed or no new mail!")

Return

END IF

// Get the number of messages that have not been read yet

Mnbr = UpperBound (mses.MessageId [])

File: // Read the last received mail content.

It is placed in the string field of MMSG's NOTETEXT

mse.mailreadMessage (mses.MessageId [MNBR],

MMSG, MAILENTIREMESSAGE!, TRUE

// put the obtained mail content into the multi-line editor MLE_1 on the window W_mai1

W_mai1.mle_1.text = mmsg.notetext

//sign out

mse.maillogoff ()

// Remove email session

Destroy MSES

---- 2. Enter the next section under the click item of the menu item "Send Mail": Mailsession MSES

MailMessage MMSG

MailreturNCode Mreturn

// Generate a message session object MSES

MSES = CREATE MAILSession

// mail login

MRETURN = mses.maillogon (MailneWSession!)

IF MRETURN <> mailreturnsuccess! then

MessageBox ("Mail Login", "Mail Login Failed!")

Return

END IF

// Pop up the email address window to get the address of the mail recipient.

Address and name are an array of structures placed in MMSG

MRETURN = MSES.MAILADDRESS (MMSG)

IF MRETURN <> mailreturnsuccess! then

MessageBox ("Mail Address", "Mail Address Error!")

Return

END IF

/ / Put the multi-line editor on the window W_mai1 MLE_1

The content is put into the Notetext field of MMSG

MMSG.NOTETEXT = W_MAI1.MLE_1.TEXT

//send email

MRETURN = mse.mailsend (MMSG)

IF MRETURN <> mailreturnsuccess! then

MessageBox ("Mail Send", "Mail Send Failed!")

Return

Else

MessageBox ("Mail Send", "Mail Send Success!")

END IF

//sign out

mse.maillogoff ()

// Remove email session

Destroy MSES

---- 3. Enter the program under the click "Address Book".

Mailsession MSES

MailMessage MMSG

MailreturNCode Mreturn

// Generate a message session object MSES

MSES = CREATE MAILSession

// mail login

MRETURN = mses.maillogon (MailneWSession!)

IF MRETURN <> mailreturnsuccess! then

MessageBox ("Mail Login", "Mail Login Failed!")

Return

END IF

// Pop up the email address window and get the address of the mail recipient

MRETURN = MSES.MAILADDRESS (MMSG)

IF MRETURN <> mailreturnsuccess! then

MessageBox ("Mail Address", "Mail Address Error!")

Return

END IF

//sign out

mse.maillogoff ()

// Remove email session

Destroy MSES

---- Third, the program. The front of the normal executive program is that Microsoft Mail household software has been installed on the machine in PowerBuild. ---- 1. Click the "Connection Mail" menu item or tool icon, and execute the procedure of the pickup. The program will be updated in the multi-line editor that has not been read or notned.

If you change MRETURN = mses.mailgetMessages (TRUE):

MRETURN = mse.mailgetMessages ()

You can get a full mail (including a read mail).

转载请注明原文地址:https://www.9cbs.com/read-2385.html

New Post(0)