This post originated from an RSS feed registered with Ruby Buzz
by Tobias Luetke.
Original Post: Action Mailer tips
Feed Title: too-biased
Feed URL: http://blog.leetsoft.com/xml/rss/
Feed Description: Read the announcement: CD Baby rewrite in Postgres and Ruby, Baby!CD Baby is going rails. This is huge! If you don’t know CD Baby, its a distribution site with over 80.000 musicians under contract and its one of the biggest digital distributors of audio to Apple iTunes, Napster, Rhapsody, etc. Read all about it here. What is even more exciting about it is that I’m on board for the rewrite and I had chance to talk to Derek on the phone directly for a consulting session which might have played its little part in the decision to go with rails. Come monday I’ll work together with him and other rails contributor Jeremy Kemper to help crunch those 90k lines of PHP in beautifully compact code for which Rails and Ruby are known. Here is a quote from Derek’s announcement on his weblog: Like a lost soul walkin’ the earth, lookin’ for spirituality, that stumbles upon the right church with the right people at the right time, I’ve found my niche with Ruby. Its little itty-bitty community attracts some brilliant “think different” types with a love for beautiful code that do this for love, not money.
OK so today I confused the hell out of my partner who does all the shipping for snowdevil.
After testing a new revision of the software I he called me and asked “Hey did you really just order 3 snowboards??!”. My local test have been dispatching emails looking just like the real thing.
Here is a simple which keeps emails going but doesn’t confuse the hell out of other people (added to your development.rb) :
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.delivery_method = :fixed_email
class ActionMailer::Base
def self.perform_delivery_fixed_email(mail)
mail.to = 'your.own@email-address.com'
mail.subject = '[DEV] ' + mail.subject
Net::SMTP.start(
server_settings[:address],
server_settings[:port],
server_settings[:domain],
server_settings[:user_name],
server_settings[:password],
server_settings[:authentication]) do |smtp|
smtp.sendmail(mail.encoded, mail.from, mail.destinations)
end
end
end
Now i get all the emails the system sends myself. Thats much better…