DataFlex
DataFlex
Send a Raw POP3 Command
See more POP3 Examples
Demonstrates the Chilkat MailMan.Pop3SendRawCommand method, which sends a raw command to the POP3 server and returns the server's response. The second argument specifies the charset to use if the command contains non-US-ASCII characters. This example sends the POP3 STAT command within an open session.
Background: POP3 is a simple line-based text protocol — the client sends short commands like
STAT, LIST, UIDL, or RETR and the server replies with +OK or -ERR. This method is an escape hatch for issuing a command Chilkat doesn't wrap directly, or a server-specific extension. Note that the session must already be open, since a raw command assumes an authenticated connection.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMailman
String sResponse
String sTemp1
Boolean bTemp1
Move False To iSuccess
// Demonstrates the MailMan.Pop3SendRawCommand method, which sends a raw command to the POP3
// server and returns the server's response. The second argument is the charset used if the
// command contains non-US-ASCII characters.
Get Create (RefClass(cComChilkatMailMan)) To hoMailman
If (Not(IsComObjectCreated(hoMailman))) Begin
Send CreateComObject of hoMailman
End
// Configure the POP3 server connection.
Set ComMailHost Of hoMailman To "pop.example.com"
Set ComMailPort Of hoMailman To 995
Set ComPopSsl Of hoMailman To True
Set ComPopUsername Of hoMailman To "user@example.com"
Set ComPopPassword Of hoMailman To "myPassword"
Get ComPop3BeginSession Of hoMailman To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMailman To sTemp1
Showln sTemp1
Procedure_Return
End
// Send the raw POP3 STAT command, which returns the message count and maildrop size.
Get ComPop3SendRawCommand Of hoMailman "STAT" "us-ascii" To sResponse
Get ComLastMethodSuccess Of hoMailman To bTemp1
If (bTemp1 = False) Begin
Get ComLastErrorText Of hoMailman To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "STAT response: " sResponse
Get ComPop3EndSession Of hoMailman To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoMailman To sTemp1
Showln sTemp1
Procedure_Return
End
End_Procedure