Skip to content

POP3 Read

Type: pop3-read  ·  Package: SMTP / IMAP Email Activities v1.0.5  ·  Output: List<ZoanMail>

Reads emails from a POP3 server and returns a list of messages (ZoanMail). POP3 is an old, limited protocol: it does not support folders, filters or read state.

Connects to the server (port 995 with ssl by default), signs in, counts the messages in the mailbox and downloads the limit most recent (default 10). Reading does not delete emails from the server or change anything: to remove them use POP3 Delete.

Since POP3 keeps no state, each read returns the same emails while they remain in the mailbox. To avoid processing twice, delete what you processed or keep track elsewhere of what you already took (for example, subject and date).

ParameterTypeDefaultDescription
hoststring—POP3 server (e.g. pop.gmail.com).
usernamestring—Username.
passwordstring—Password or App Password, as text: use credential("name")["password"] (or credential("name")["value"] if the credential holds a single value).
ParameterTypeDefaultDescription
portint995POP3 port. With TLS: 995; unencrypted or with starttls: 110.
limitint10Maximum number of emails to return (the most recent).
includeAttachmentsboolfalseDownloads attachment content into .Attachments (name, MIME type and bytes).
securitystring"ssl"Encryption: auto, none, ssl or starttls. See Encryption and ports.
acceptInvalidCertsboolfalseAccepts untrusted (self-signed) TLS certificates, useful on test servers. Do not enable it against production servers.

Returns a List<ZoanMail> with up to limit emails, from oldest to newest within that group. Each email has:

PropertyContent
.IdMessage index in the mailbox, from 0 (numeric text). Use it as mailId in POP3 Delete.
.Subject, .From, .To, .CcSubject, sender address and recipient addresses.
.Body / .IsHtmlPlain text of the email; if it only has HTML, the HTML with .IsHtml = true.
.SentAtDate from the Date header (sent date).
.IsReadAlways false (POP3 has no read state).
.AttachmentsAttachments with content if includeAttachments = true; otherwise empty.

If the mailbox is empty, it returns an empty list.

MessageCause and fix
'host' is required. (and the same for username, password)The parameter is missing or the expression returned null.
Server authentication errorWrong username or password, App Password required, or POP3 disabled for the account. If you passed credential("name") without ["password"], the text sent is not the password.
Connection or TLS errorWrong host or port, security does not match the port, or the server certificate is not trusted (on a test server, acceptInvalidCerts = true).
POP3 Read host = "pop.gmail.com" username = credential("mail-bot")["user"] password = credential("mail-bot")["password"] limit = 20 → output: emails
For Each items = emails itemVariable = email
└─ activities:
Log message = email.SentAt.ToString("yyyy-MM-dd HH:mm") + " · " + email.From + " — " + email.Subject
  • IMAP Read — recommended alternative, with folders and filters.
  • POP3 Delete — delete an email you read.