https://github.com/bumi/mailman
A little man who helps you getting emails from your imap account...
https://github.com/bumi/mailman
Last synced: 8 months ago
JSON representation
A little man who helps you getting emails from your imap account...
- Host: GitHub
- URL: https://github.com/bumi/mailman
- Owner: bumi
- Created: 2010-01-20T18:41:09.000Z (over 16 years ago)
- Default Branch: master
- Last Pushed: 2010-01-20T18:52:26.000Z (over 16 years ago)
- Last Synced: 2025-03-21T22:03:11.913Z (about 1 year ago)
- Language: Ruby
- Homepage:
- Size: 70.3 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.mdown
Awesome Lists containing this project
README
Mailman
=============
Mailman is a little script that helps you dealing with imap mail accounts.
Example 1:
--------------
mailman = Mailman.new({
:server => "...",
:port => 143,
:use_ssl => false,
:username => "...",
:password => "...",
:logger =>Logger.new("log/mail_import.log"),
:on_exception => Proc.new{|e| HoptoadNotifier.notify(e)}}
)
mailman.with("INBOX") do
emails(["SUBJECT", "keyword"]).each do |message_id, email|
if Importers::Mail.receive(email)
copy(message_id,"INBOX.imported")
store(message_id, [:Seen, :Deleted])
log "successfully imported email ##{message_id}"
else
log "could not import email ##{message_id}"
HoptoadNotifier.notify({ :error_class => "Mailman Import Error #{message_id}", :request => {:params => {:message_id => message_id }}})
copy(message_id,"INBOX.not_imported")
store(message_id, [:Seen, :Deleted])
end
expunge
end
end
Example 2:
--------------
mailman = Mailman.new({
:server => "...",
:port => 143,
:use_ssl => false,
:username => "...",
:password => "...",
:logger =>Logger.new("log/mail_import.log"),
:on_exception => Proc.new{|e| HoptoadNotifier.notify(e)}}
)
mailman.login
mailman.select "INBOX"
mailman.emails.each do |id,email|
...
end
mailman.quit