⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.133
Server IP:
185.119.109.197
Server:
Linux managedhosting.chostar.me 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
3.0.0
/
system
/
Net
/
POP3
/
View File Name :
cdesc-POP3.ri
U:RDoc::NormalClass[iI" POP3:ETI"Net::POP3;TI" Protocol;To:RDoc::Markup::Document:@parts[o;;[.S:RDoc::Markup::Heading: leveli: textI"What is This Library?;To:RDoc::Markup::BlankLine o:RDoc::Markup::Paragraph;[I"8This library provides functionality for retrieving ;TI"Eemail via POP3, the Post Office Protocol version 3. For details ;TI"Bof POP3, see [RFC1939] (http://www.ietf.org/rfc/rfc1939.txt).;T@S; ; i;I" Examples;T@S; ; i;I"Retrieving Messages;T@o; ;[I"FThis example retrieves messages from the server and deletes them ;TI"on the server.;T@o; ;[ I"DMessages are written to files named 'inbox/1', 'inbox/2', .... ;TI"BReplace 'pop.example.com' with your POP3 server address, and ;TI"C'YourAccount' and 'YourPassword' with the appropriate account ;TI" details.;T@o:RDoc::Markup::Verbatim;[I"require 'net/pop' ;TI" ;TI",pop = Net::POP3.new('pop.example.com') ;TI"@pop.start('YourAccount', 'YourPassword') # (1) ;TI"if pop.mails.empty? ;TI" puts 'No mail.' ;TI" else ;TI" i = 0 ;TI"@ pop.each_mail do |m| # or "pop.mails.each ..." # (2) ;TI"- File.open("inbox/#{i}", 'w') do |f| ;TI" f.write m.pop ;TI" end ;TI" m.delete ;TI" i += 1 ;TI" end ;TI". puts "#{pop.mails.size} mails popped." ;TI" end ;TI"@pop.finish # (3) ;T:@format0o:RDoc::Markup::List: @type:NUMBER:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"0Call Net::POP3#start and start POP session.;To;;0;[o; ;[I"?Access messages by using POP3#each_mail and/or POP3#mails.;To;;0;[o; ;[I"NClose POP session by calling POP3#finish or use the block form of #start.;T@S; ; i;I"Shortened Code;T@o; ;[I"JThe example above is very verbose. You can shorten the code by using ;TI"Hsome utility methods. First, the block form of Net::POP3.start can ;TI"=be used instead of POP3.new, POP3#start and POP3#finish.;T@o;;[I"require 'net/pop' ;TI" ;TI"-Net::POP3.start('pop.example.com', 110, ;TI"= 'YourAccount', 'YourPassword') do |pop| ;TI" if pop.mails.empty? ;TI" puts 'No mail.' ;TI" else ;TI" i = 0 ;TI": pop.each_mail do |m| # or "pop.mails.each ..." ;TI"/ File.open("inbox/#{i}", 'w') do |f| ;TI" f.write m.pop ;TI" end ;TI" m.delete ;TI" i += 1 ;TI" end ;TI"0 puts "#{pop.mails.size} mails popped." ;TI" end ;TI" end ;T;0o; ;[I"BPOP3#delete_all is an alternative for #each_mail and #delete.;T@o;;[I"require 'net/pop' ;TI" ;TI"-Net::POP3.start('pop.example.com', 110, ;TI"= 'YourAccount', 'YourPassword') do |pop| ;TI" if pop.mails.empty? ;TI" puts 'No mail.' ;TI" else ;TI" i = 1 ;TI" pop.delete_all do |m| ;TI"/ File.open("inbox/#{i}", 'w') do |f| ;TI" f.write m.pop ;TI" end ;TI" i += 1 ;TI" end ;TI" end ;TI" end ;T;0o; ;[I")And here is an even shorter example.;T@o;;[I"require 'net/pop' ;TI" ;TI"i = 0 ;TI"2Net::POP3.delete_all('pop.example.com', 110, ;TI"@ 'YourAccount', 'YourPassword') do |m| ;TI"+ File.open("inbox/#{i}", 'w') do |f| ;TI" f.write m.pop ;TI" end ;TI" i += 1 ;TI" end ;T;0S; ; i;I"Memory Space Issues;T@o; ;[I"@All the examples above get each message as one big string. ;TI"This example avoids this.;T@o;;[I"require 'net/pop' ;TI" ;TI"i = 1 ;TI"2Net::POP3.delete_all('pop.example.com', 110, ;TI"@ 'YourAccount', 'YourPassword') do |m| ;TI"+ File.open("inbox/#{i}", 'w') do |f| ;TI"? m.pop do |chunk| # get a message little by little. ;TI" f.write chunk ;TI" end ;TI" i += 1 ;TI" end ;TI" end ;T;0S; ; i;I"Using APOP;T@o; ;[I"7The net/pop library supports APOP authentication. ;TI"JTo use APOP, use the Net::APOP class instead of the Net::POP3 class. ;TI"CYou can use the utility method, Net::POP3.APOP(). For example:;T@o;;[I"require 'net/pop' ;TI" ;TI"2# Use APOP authentication if $isapop == true ;TI"@pop = Net::POP3.APOP($isapop).new('apop.example.com', 110) ;TI"7pop.start('YourAccount', 'YourPassword') do |pop| ;TI"' # Rest of the code is the same. ;TI" end ;T;0S; ; i;I"6Fetch Only Selected Mail Using 'UIDL' POP Command;T@o; ;[I"5If your POP server provides UIDL functionality, ;TI";you can grab only selected mails from the POP server. ;TI" e.g.;T@o;;[I"def need_pop?( id ) ;TI"/ # determine if we need pop this mail... ;TI" end ;TI" ;TI"-Net::POP3.start('pop.example.com', 110, ;TI"? 'Your account', 'Your password') do |pop| ;TI"C pop.mails.select { |m| need_pop?(m.unique_id) }.each do |m| ;TI" do_something(m.pop) ;TI" end ;TI" end ;T;0o; ;[I"NThe POPMail#unique_id() method returns the unique-id of the message as a ;TI"=String. Normally the unique-id is a hash of the message.;T: @fileI"lib/net/pop.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[[ I"address;TI"R;T:publicFI"lib/net/pop.rb;T[ I"open_timeout;TI"RW;T;F@Ã[ I"read_timeout;T@Â;F@Ã[U:RDoc::Constant[i I"VERSION;TI"Net::POP3::VERSION;T;0o;;[o; ;[I"version of this library;T;@¾;0@¾@cRDoc::NormalClass0[ [[I" class;T[[;[[I" APOP;T@Ã[I"auth_only;T@Ã[I" certs;T@Ã[I"create_ssl_params;T@Ã[I"default_pop3_port;T@Ã[I"default_pop3s_port;T@Ã[I"default_port;T@Ã[I"delete_all;T@Ã[I"disable_ssl;T@Ã[I"enable_ssl;T@Ã[I"foreach;T@Ã[I"new;T@Ã[I"ssl_params;T@Ã[I" start;T@Ã[I" use_ssl?;T@Ã[I"verify;T@Ã[:protected[ [:private[ [I" instance;T[[;[[I"active?;T@Ã[I" apop?;T@Ã[I"auth_only;T@Ã[I"delete_all;T@Ã[I"disable_ssl;T@Ã[I" each;T@Ã[I"each_mail;T@Ã[I"enable_ssl;T@Ã[I"finish;T@Ã[I"inspect;T@Ã[I"logging;T@Ã[I" mails;T@Ã[I"n_bytes;T@Ã[I"n_mails;T@Ã[I" port;T@Ã[I"read_timeout=;T@Ã[I" reset;T@Ã[I"set_debug_output;T@Ã[I" start;T@Ã[I" started?;T@Ã[I" use_ssl?;T@Ã[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@¾I"Net;TcRDoc::NormalModule