we have some machines running 24/7 and they mail some basic diagnostics and results every night to a gmail account. Our server automatically downloads and manipulates the data to have an everyday overview of the machine's performance. I run this all with mRpostman and make the connection like this:
require(mRpostman)
con <- configure_imap(url=imaps://imap.gmail.com,
username="topsecret@gmail.com",
password="topsecret",
use_ssl = T,
verbose = T,
buffersize = 512000,
timeout_ms = 10000)
The connection works well, the download is robust, I search for the subject of the emails (which are marked with date_customer_location_line_machinetype_datatype) and extract the UID like this:
search.log <- "date_customer_location_line_machinetype_datatype"
today <- Sys.Date
find.log <- con$search(request = AND(string(expr = search.log, where = "SUBJECT"),
since(date_char = today)), use_uid = T)
> find.log
[1] 38815 38816 38817 38818 38819
In find.log I get a vector with UID's, and as already mentioned, the download of the attachments works well.
As the mailbox runs full after some weeks I want to delete all messages once a week with
con$delete_msg(msg_id = find.log, use_uid = T, mute = F, retries = 3))
::mRpostman: message(s) deleted.
con$expunge(msg_uid = find.log, mute = F, retries = 3))
::mRpostman: expunge successfuly executed.
Although mRpostman reports both operations as successful, the mailbox is still full... I set the retries parameter to 3 to exclude this as a source of error, but it did not help.
Sorry for the nonreproducible example, if someone has a suggestion to make it more transparent I will incorporate it in this example.
Any suggestions on what I do wrong?