943,902 Members | Top Members by Rank

Ad:
  • Ruby Discussion Thread
  • Marked Solved
  • Views: 6798
  • Ruby RSS
Mar 8th, 2007
0

send mail

Expand Post »
how to send a mail using ruby..?plz help me
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
amithasija is offline Offline
44 posts
since Nov 2006
Mar 8th, 2007
0

Re: send mail

Click to Expand / Collapse  Quote originally posted by amithasija ...
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'

Ruby Syntax (Toggle Plain Text)
  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.
pty
Reputation Points: 64
Solved Threads: 39
Posting Pro
pty is offline Offline
530 posts
since Oct 2005
Apr 8th, 2007
0

Re: send mail

You can also do the same by checking this post of mine here -
http://sitekreator.com/satishtalim/smtp_class.html
Reputation Points: 10
Solved Threads: 1
Newbie Poster
IndianGuru is offline Offline
9 posts
since Apr 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Ruby Forum Timeline: ajax in selection box
Next Thread in Ruby Forum Timeline: Count Object On Page





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC