Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ruby client api for Internet Message Access Protocol

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE.txt
Unknown
COPYING
NotificationsYou must be signed in to change notification settings

ruby/net-imap

Repository files navigation

Net::IMAP implements Internet Message Access Protocol (IMAP) clientfunctionality. The protocol is described inRFC3501,RFC9051 and various extensions.

Installation

Add this line to your application's Gemfile:

gem'net-imap'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install net-imap

Usage

Connect with TLS to port 993

imap=Net::IMAP.new('mail.example.com',ssl:true)imap.port=>993imap.tls_verified?=>truecaseimap.greeting.namein/OK/i# The client is connected in the "Not Authenticated" state.imap.authenticate("PLAIN","joe_user","joes_password")in/PREAUTH/i# The client is connected in the "Authenticated" state.end

List sender and subject of all recent messages in the default mailbox

imap.examine('INBOX')imap.search(["RECENT"]).eachdo |message_id|envelope=imap.fetch(message_id,"ENVELOPE")[0].attr["ENVELOPE"]puts"#{envelope.from[0].name}:\t#{envelope.subject}"end

Move all messages from April 2003 from "Mail/sent-mail" to "Mail/sent-apr03"

imap.select('Mail/sent-mail')ifimap.list('Mail/','sent-apr03').empty?imap.create('Mail/sent-apr03')endimap.search(["BEFORE","30-Apr-2003","SINCE","1-Apr-2003"]).eachdo |message_id|ifimap.capable?(:move) ||imap.capable?(:IMAP4rev2)imap.move(message_id,"Mail/sent-apr03")elseimap.copy(message_id,"Mail/sent-apr03")imap.store(message_id,"+FLAGS",[:Deleted])endendimap.expunge

Development

After checking out the repo, runbin/setup to install dependencies. Then, runbundle exec rake test to run the tests. You can also runbin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, runbundle exec rake install. To release a new version, update the version number inversion.rb, and then runbundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the.gem file torubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub athttps://github.com/ruby/net-imap.

About

Ruby client api for Internet Message Access Protocol

Topics

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE.txt
Unknown
COPYING

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp