954,124 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

send mail

how to send a mail using ruby..?plz help me

amithasija
Light Poster
44 posts since Nov 2006
Reputation Points: 10
Solved Threads: 0
 
how to send a mail using ruby..?plz help me

quick example using action_mailer.

If you don't have it already gem install 'action_mailer'

require 'action_mailer'

ActionMailer::Base.server_settings = {
  :address => "your.smtp.server",
  :port => 25, 
  :domain => 'yourdomain',
  :user_name => "your_user_name",
  :password => "shhhsecret",
  :authentication => :login
} 

class Emailer < ActionMailer::Base
  def test_email(user_email)
    subject    "Free C1Alis"
    from       "system@example.com"
    recipients user_email.address
    body	"Get large, #{user_email.name}!"
  end
end

@email_addresses = [ { :name => "Bobby Ewing", :address => "bobby@dallas.com" }, { :name => "Ewing, JR", :address => "jr@dallas.com" } ]

@email_addresses.each do |e|
	Emailer.deliver_test_email(e)
end
pty
Posting Pro
530 posts since Oct 2005
Reputation Points: 64
Solved Threads: 39
 

You can also do the same by checking this post of mine here -
http://sitekreator.com/satishtalim/smtp_class.html

IndianGuru
Newbie Poster
9 posts since Apr 2007
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You