$stat=Pop3.GetMail() Online IVR Tutorial
Return Value List of Supporting Functions:
Functions Description Return Value
Pop3.SetSSL(Type) This function is to set the type of the connection. The parameter "Type" is set as 0 when the connection is not secure, type 1 specifies that the TLS type is used, 2 specifies that the StartTLS type is used. None.
Pop3.Connect("<Server>", <Port> This function is to establish a connection to Pop3 server. The parameter "Server" specifies the Pop3 server address and "Port" specifies the port number. The default port for Pop3 server is 110.
Returns a boolean value.
Pop3.Close()  This function is used to close the connection with the server. Once the function is opened, it has to be closed by using this function. None.
Pop3.Login("<User>", "<Pass>")  This function is used to provide the login information of the user. The parameter "User" specifies the username, "Pass" specifies the password. Returns a boolean value.
Pop3.GetCount()  This function is used to count the number of mails that are present in the server to be fetched. Returns an integer value.
Pop3.GetTotalSize() This function is used to get the overall size of the mails that are to be fetched from the server. Returns an integer value.
Pop3.GetMailSize("<MailNo>")  This function is to get the size of the specific mail. It accepts the "MailNumber" as the parameter. Returns an integer value. It returns -1 on error.
Pop3.DeleteMail(<MailNo>) This function is used to delete the mail. It takes "MailNumber" as the parameter and deletes that mail.
Returns a boolean value.
Pop3.FetchMail("<MailNo>") This function is used to fetch the mail based on the mail number. It takes mail number as the parameter. Returns a boolean value.
Pop3.FetchHeader("<MailNo>") This function is used to get the header of the mail based on the mail number. It accepts mail number as the parameter. Returns a boolean value.
Pop3.GetMail() This function is used to get the last fetched mail from the Pop3 server. Returns raw data.
Pop3.GetHeader() This function is used to get the header part of the last fetched mail from the Pop3 server. Returns raw data.
Pop3.GetBody() This function is used to get the mail body of the last fetched mail from the Pop3 server. Returns raw data.
Pop3.GetField("<HeaderField>") This function is used to fetch the header fields of the mail. It accepts the header field as the parameter. Returns string value.
Pop3.GetAttachmentCount() This function is used to get the number of attachments in a mail. Returns an integer.
Pop3.FetchAttachment("<AttachmentNo>") This function is used to fetch the attachment from the server on the basis of the attachment number. The parameter "Attachment number" specifies the serial number of the attachment. Returns a boolean value.
Pop3.GetAttachmentType() This function is used to get the type of the attachment. Returns a string.
Pop3.GetAttachmentName() This function is used to get the name of the attachment. Returns a string.
Pop3.GetAttachmentSize() This function is used to get the size of the attachment. Returns a string.
Pop3.SaveAttachment("<Name>") This function is used to save the attachment. The parameter "Name" specifies the name by which the attachment is saved at the time of download. Returns a boolean value.

Remarks Example

MAIN:

    answer 1
    	pop3.SetSSL(1)
   $stat = pop3.Connect("190.165.14.1",995)
if $stat
    $stat = pop3.login("admin","admin")
    if $stat
        $noofmail = pop3.GetCount()
        $MailCtr = 1
        while $MailCtr <= $noofmail
            $stat = pop3.FetchMail($MailCtr)
            if $stat
                $data = pop3.GetMail()
                $headers = pop3.GetHeader()
                $To = pop3.GetField("To")
                $ACount = pop3.GetAttachmentCount()
                $Count = 1
                while $Count <= $Acount
                    if pop3.FetchAttachment($count)
                        $Type = pop3.GetAttachmentType()
                        $AttachName = pop3.GetAttachmentName()
                        $Size = pop3.GetAttachmentSize()
                        if $Type = "application/pdf"
                            pop3.SaveAttachment(format("C:\pdf\%d.pdf",$count))
                        endif
                    endif
                    $Count = $Count + 1
                endwhile
            endif
            $MailCtr = $MailCtr + 1
        endwhile
    endif
    pop3.close()
endif