D
Deepa Rajendran
Hai friends,
I received an attachment file in a encoding format but i want
to get it as s text file.And those file want to store it in a specified
Folder.
Here the coding is:
require 'rubygems'
require 'net/pop'
require 'tlsmail'
require 'net/smtp'
BASE_DIR = "C:\Documents and Settings\mpf18.MPFD18\Desktop\attachment"
username = 'username'
password = 'password'
Net:
OP3.enable_ssl(OpenSSL::SSL::VERIFY_NONE)
conn = Net:
OP3.new('pop.gmail.com',Net:
OP3.default_pop3s_port)
conn.start(username, password)
conn.each_mail do |msg|
# Print the 'From:' header line
#puts msg.header.split("\r\n").grep(/^From: /)
filename=msg.header.split("\r\n").grep(/^From: /)
puts filename
# File.open(File.join("#{BASE_DIR}/#{filename}"),
File::CREAT|File::TRUNC|File::WRONLY) do |f|
# f.write(msg)
# Put message to $stdout (by calling <<)
puts "\nFull message:\n"
msg.all($stdout)
#end
end
I received an attachment file in a encoding format but i want
to get it as s text file.And those file want to store it in a specified
Folder.
Here the coding is:
require 'rubygems'
require 'net/pop'
require 'tlsmail'
require 'net/smtp'
BASE_DIR = "C:\Documents and Settings\mpf18.MPFD18\Desktop\attachment"
username = 'username'
password = 'password'
Net:
conn = Net:
conn.start(username, password)
conn.each_mail do |msg|
# Print the 'From:' header line
#puts msg.header.split("\r\n").grep(/^From: /)
filename=msg.header.split("\r\n").grep(/^From: /)
puts filename
# File.open(File.join("#{BASE_DIR}/#{filename}"),
File::CREAT|File::TRUNC|File::WRONLY) do |f|
# f.write(msg)
# Put message to $stdout (by calling <<)
puts "\nFull message:\n"
msg.all($stdout)
#end
end