The calendar is gone.
Click here to view posts


Action mailer recieving attchments
So I posted before about receiving voice mail and having populate on the internet. Well step one is checking the mail. As it turns out my email for my server is stored in a local dir. This is really good news because it appears that action mailer does not check email. First I need to add a receive method to my mail model:
    def receive(email)
		email
    end

Done! But you say it does nothing? I know. I hate changing code in models and then restarting the server. For now my logic will stay in the controller:

def test
#open the local file and read it in.
x=Notifier.receive(File.read("/home/giggles/realybadsite/1184671181.V9I760a7f6.popeyemail.com"))
#at this point x is a TMail::Mail (links below)
# x.attachments will be an array that has a TMail::Attachment which inherits from StringIO
# This holds the attachment ruby/gems/1.8/gems/actionmailer-1.3.2/lib/action_mailer/vendor/tmail/attachment.rb
# it also has original_filename and content_type
File.open(Dir.pwd+"/tmp/"+x.attachments.first.original_filename,"w+"){|file|
	file << x.attachments.first.gets
}

end


Now that I have access to the mail object and I can save the attached file I can now store the necessary data for my website.

For a list of methods on the TMail object try this website http://railsmanual.com/class/TMail::Mail

TMail