Skip to content

POP3 Delete

Type: pop3-delete  ·  Package: SMTP / IMAP Email Activities v1.0.5

Deletes an email from a POP3 server, identified by its index (the .Id returned by POP3 Read).

Connects (port 995 with ssl by default), flags the message at position mailId for deletion and closes the session, which is when the server applies the deletion. Deletion is permanent: POP3 has no trash.

Because each activity opens its own connection, when a message is deleted the ones after it get a lower index in the next connection. If you are going to delete several emails from the same read, do it from the highest index to the lowest, or read again after each deletion.

ParameterTypeDefaultDescription
hoststring—POP3 server.
usernamestring—Username.
passwordstring—Password, as text: use credential("name")["password"].
mailIdstring—Email index (from email.Id of POP3 Read): an integer from 0.
ParameterTypeDefaultDescription
portint995POP3 port.
securitystring"ssl"Encryption: auto, none, ssl or starttls.
acceptInvalidCertsboolfalseAccepts untrusted (self-signed) TLS certificates, useful on test servers. Do not enable it against production servers.

This activity does not return a value.

MessageCause and fix
Invalid 'mailId'. It must be the numeric index returned by pop3-read.mailId is not an integer greater than or equal to 0. Pass email.Id from POP3 Read.
'host' is required. (and the same for username, password, mailId)The parameter is missing or the expression returned null.
Index out of range errorThe mailbox no longer has a message at that position (others were deleted first). Read again with POP3 Read.
Authentication or connection errorSame as in POP3 Read.

Read, process and delete the most recent email in the mailbox:

POP3 Read host = "pop.gmail.com" username = credential("mail-bot")["user"] password = credential("mail-bot")["password"] limit = 1 → output: emails
For Each items = emails itemVariable = email
└─ activities:
... process the email ...
POP3 Delete host = "pop.gmail.com" username = credential("mail-bot")["user"] password = credential("mail-bot")["password"] mailId = email.Id