User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Ruby section within the Web Development category of DaniWeb, a massive community of 402,576 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,256 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Ruby advertiser: SELL YOUR PRODUCT TODAY !
Views: 3201 | Replies: 2 | Solved
Reply
Join Date: Nov 2006
Location: new delhi
Posts: 38
Reputation: amithasija is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
amithasija amithasija is offline Offline
Light Poster

send mail

  #1  
Mar 8th, 2007
how to send a mail using ruby..?plz help me
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2005
Location: Manchester, UK
Posts: 481
Reputation: pty is on a distinguished road 
Rep Power: 3
Solved Threads: 31
pty's Avatar
pty pty is offline Offline
Posting Pro in Training

Re: send mail

  #2  
Mar 8th, 2007
Originally Posted by amithasija View Post
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

Last edited by pty : Mar 8th, 2007 at 9:46 am.
Note to self... pocket cup
Reply With Quote  
Join Date: Apr 2007
Location: Pune, India
Posts: 9
Reputation: IndianGuru is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
IndianGuru IndianGuru is offline Offline
Newbie Poster

Re: send mail

  #3  
Apr 8th, 2007
You can also do the same by checking this post of mine here -
http://sitekreator.com/satishtalim/smtp_class.html
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Ruby Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Ruby Forum

All times are GMT -4. The time now is 10:47 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC