WebPopRetr Function

Action

Retrieves a message with number nMsg from the server.

Include file

WebAPI.bdh

Syntax

WebPopRetr( in  hPop     : number, 
            in  nMsg     : number, 
            out sMailMsg : string optional, 
            in  nMaxSize : number optional): boolean;

Return value

  • true if the response was successfully received and the server confirmed with "+OK"

  • false otherwise

Parameter Description
hPop Handle to a Web connection that was created by WebPopConnect.
nMsg Number of the message to retrieve.
sMailMsg String buffer receiving the mail message (optional).
nMaxSize Size of the string buffer receiving the mail message (optional). Specify STRING_COMPLETE to get all received data.

Example

dcltrans 
  transaction TWebPop3 
  const
    USERNAME := "username";
    PASSWORD := "password"; 
  var
    hPop, nMessages, nSize : number;
    sMsg                   : string; 
  begin    WebPopConnect(hPop, "standardhost", WEB_PORT_POP3); 
    // try to log in using secure MD5 encryption 
    if not WebPopApop(hPop, USERNAME, PASSWORD) then 
      // if APOP fails, try normal user/pass sequence 
      if not WebPopUser(hPop, USERNAME) or 
      not WebPopPass(hPop, PASSWORD) then
      WebPopShutdown(hPop); return 1; 
      end; 
    end;

    // retrievemail status information
    WebPopStat(hPop, nMessages, nSize);
    WebPopList(hPop, IGNORE);

    // retrieve and delete all messages 
    while nMessages > 0 do 
      WebPopRetr(hPop, nMessages, sMsg);
      WebPopDele(hPop, nMessages);
      nMessages := nMessages - 1; 
    end;

    // roll back the delete command (no msgs will be deleted)
    WebPopRset(hPop); 

    // commit pop transaction
    WebPopQuit(hPop);

    WebPopShutdown(hPop); 
  end TWebPop3;

SilkEssential sample

eMail.sep