actionmailbox-imap 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/actionmailbox/imap/adapters/net_imap.rb +10 -2
- data/lib/actionmailbox/imap/mailbox.rb +1 -1
- data/lib/actionmailbox/imap/message.rb +8 -0
- data/lib/actionmailbox/imap/messages.rb +12 -0
- data/lib/actionmailbox/imap/version.rb +1 -1
- data/lib/tasks/actionmailbox/ingress.rake +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf597bbca58917880d28d6b9ea482e0c67d0dc1aba28c3ce643f297e5c0860df
|
4
|
+
data.tar.gz: be76ffc403639b411d67d18e651b7933633c95e0abe5be55cfbf365e84bc369f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b501f7a5e650d176d287c773115f11cebcaf639a54dfd81ce781350c9fbedfd89134fbf0011764dd7efc500bc0d6947faf0724be58a4d78bb2269ef0ce66e0dd
|
7
|
+
data.tar.gz: d8c7e4a75a3b89fac41c5a426aaf8f3b1b34cc06369be9657bbeaaea275fc11947a7376f34c47fc89d296b69d35af05f957263670b0d593d34b565e8e7d88d19
|
data/README.md
CHANGED
@@ -16,7 +16,7 @@ If the rake task fails to relay a message to ActionMailbox then it will ignore i
|
|
16
16
|
It seems that there is no plans to create some sort of IMAP implementation relay in ActionMailbox.
|
17
17
|
https://github.com/rails/actionmailbox/issues/14
|
18
18
|
|
19
|
-
There is probably a reason for this. We did not want to setup or maintain a mailserver which would probably be the route to go for a robust
|
19
|
+
There is probably a reason for this. We did not want to setup or maintain a mailserver which would probably be the route to go for a robust inbound email application.
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
@@ -21,14 +21,22 @@ module ActionMailbox
|
|
21
21
|
imap.disconnect
|
22
22
|
end
|
23
23
|
|
24
|
-
def
|
25
|
-
imap.search(["NOT", "DELETED"])
|
24
|
+
def messages
|
25
|
+
imap.search(["NOT", "DELETED", "NOT", "SEEN"])
|
26
26
|
end
|
27
27
|
|
28
28
|
def delete_message(id)
|
29
29
|
imap.store(id, "+FLAGS", [:Deleted])
|
30
30
|
end
|
31
31
|
|
32
|
+
def mark_message_seen(id)
|
33
|
+
imap.store(id, "+FLAGS", [:Seen])
|
34
|
+
end
|
35
|
+
|
36
|
+
def mark_message_unseen(id)
|
37
|
+
imap.store(id, "-FLAGS", [:Seen])
|
38
|
+
end
|
39
|
+
|
32
40
|
def fetch_message_attr(id, attr)
|
33
41
|
imap.fetch(id, attr).first.attr[attr]
|
34
42
|
end
|
@@ -25,6 +25,18 @@ module ActionMailbox
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def mark_read
|
29
|
+
message_ids.each do |id|
|
30
|
+
adapter.mark_message_seen(id)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def mark_unread
|
35
|
+
message_ids.each do |id|
|
36
|
+
adapter.mark_message_unseen(id)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
28
40
|
private
|
29
41
|
|
30
42
|
attr_reader :adapter, :message_ids
|
@@ -28,9 +28,14 @@ namespace :action_mailbox do
|
|
28
28
|
|
29
29
|
relayer = ActionMailbox::Relayer.new(url: url, password: password)
|
30
30
|
|
31
|
-
mailbox.messages.take(config[:take])
|
31
|
+
messages = mailbox.messages.take(config[:take])
|
32
|
+
|
33
|
+
messages.mark_read
|
34
|
+
|
35
|
+
messages.each do |message|
|
32
36
|
relayer.relay(message.rfc822).tap do |result|
|
33
37
|
message.delete if result.success?
|
38
|
+
message.mark_unread unless result.success?
|
34
39
|
end
|
35
40
|
end
|
36
41
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionmailbox-imap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan Knowlton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|