bobbit31
asked on
Ruby and Regex and POP
I have 2 questions:
1.) -------------------
How to write a string.split command that will take the following line and return an array of 2 email addresses:
To: "Stuart Smith" <stuart@email.com>, "Community" <comm@email.com>
2.)--------------------
I built a pop3 reader using something very similar to below however, I am looking to store the actual attachment as the mime-type itself like a PDF. Any help?
1.) -------------------
How to write a string.split command that will take the following line and return an array of 2 email addresses:
To: "Stuart Smith" <stuart@email.com>, "Community" <comm@email.com>
2.)--------------------
I built a pop3 reader using something very similar to below however, I am looking to store the actual attachment as the mime-type itself like a PDF. Any help?
POP3.start('pop.example.com', 110,
'YourAccount, 'YourPassword') do |pop|
n = 1
pop.mails.each do |popmail|
File.open("inbox/#{n}", 'w') do |f|
f.write popmail.pop
end
popmail.delete
n += 1
end
end
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry bobbit I can't agree to your deletion
- I answered the first half of your question, you should award that at least
- I asked for clarification for the second part, you never gave that clarification
- I answered the first half of your question, you should award that at least
- I asked for clarification for the second part, you never gave that clarification
ASKER
sorry, i don't recall trying to delete this. i agree you deserve points.
no problem,
cheers
cheers
the block is a simple regex substitution
2) I am not sure I understand the second part of your question actually
Do you want to safe the attachment and give it an extension based on the mime type?