Pulling in email via IMAP to rails application
I am pulling email into my app via imap using Net::IMAP and copying the mail into an All Mail folder then marking it in inbox as deleted.
This then enables a backup of all emails for the user in All email folder and my app only pulls in emails from the inbox not flagged as deleted.
This works fine for gmail but i am trying to do it for horde webmail.
I successfully pull in the emails but cant seem to flag them as deleted and copy them to another folder.
Here is my code for doing this in gmail :
imap.uid_copy(uid, "[Gmail]/All Mail")
imap.uid_store(uid, "+FLAGS", [:Deleted])
Any one help with this? What should the "[Gmail]/All Mail") be changed to for horde webmail? Is this different for all email like hotmail / yahoo etc?
Any help on this would be gr开发者_Python百科eat. thanks
rick
can you try this?
connection.store( uid , "+FLAGS", [:DELETED])
...
connection.expunge()
e.g. "store" instead of "uid_store" ?
I'm not using Horde, but the above line is working for me for several IMAP servers.
Also make sure that you call connection.expunge on the mailbox where you flagged the messages for deletion..!
e.g. look at the net/imap API for #expunge: http://www.ruby-doc.org/stdlib/libdoc/net/imap/rdoc/classes/Net/IMAP.html#M001441
精彩评论