require ‘mapi/msg’
public_folder = “public”
msg_file_folder = “msg_file”
attachment_folder = ‘Attachment_pdf’
msg_file_name = ‘testfile.msg’
public_path = File.expand_path(public_folder)
file_path = File.join(public_path, msg_file_folder, msg_file_name)
download_file_path = File.join(public_path, attachment_folder)
msg = Mapi::Msg.open(file_path)
a = msg.attachments.first.save(“/test.pdf”)
puts msg.subject