send mail

Thread Solved

Join Date: Nov 2006
Posts: 44
Reputation: amithasija is an unknown quantity at this point 
Solved Threads: 0
amithasija amithasija is offline Offline
Light Poster

send mail

 
0
  #1
Mar 8th, 2007
how to send a mail using ruby..?plz help me
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 523
Reputation: pty is on a distinguished road 
Solved Threads: 37
pty's Avatar
pty pty is offline Offline
Posting Pro

Re: send mail

 
0
  #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'

  1.  
  2. require 'action_mailer'
  3.  
  4. ActionMailer::Base.server_settings = {
  5. :address => "your.smtp.server",
  6. :port => 25,
  7. :domain => 'yourdomain',
  8. :user_name => "your_user_name",
  9. :password => "shhhsecret",
  10. :authentication => :login
  11. }
  12.  
  13. class Emailer < ActionMailer::Base
  14. def test_email(user_email)
  15. subject "Free C1Alis"
  16. from "system@example.com"
  17. recipients user_email.address
  18. body "Get large, #{user_email.name}!"
  19. end
  20. end
  21.  
  22. @email_addresses = [ { :name => "Bobby Ewing", :address => "bobby@dallas.com" }, { :name => "Ewing, JR", :address => "jr@dallas.com" } ]
  23.  
  24. @email_addresses.each do |e|
  25. Emailer.deliver_test_email(e)
  26. end
Last edited by pty; Mar 8th, 2007 at 10:46 am.
Note to self... pocket cup
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 9
Reputation: IndianGuru is an unknown quantity at this point 
Solved Threads: 1
IndianGuru IndianGuru is offline Offline
Newbie Poster

Re: send mail

 
0
  #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 Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC