Jesús Gabriel y Galán
10/16/2007 11:08:00 AM
On 10/16/07, Mohit Sindhwani <mo_mail@onghu.com> wrote:
> Vellingiri Arul wrote:
> > Dear friends,
> > Can anybody try this question.
> > Is there any way to send the message our own email,for
> > example.yahoo-id,rediff-id.
> > how can we send the message using ruby program.Is there any classes.
> > If any one try means please give the solution to me.
> For me, I use SMTP and it works fine :)
This is how I do it, with ActionMailer is extra simple !!!:
require 'action_mailer'
ActionMailer::Base.smtp_settings = { :address => 'your_smtp_address',
:domain => 'a_valid_domain_for_the_smtp_server'}
class SimpleMail < ActionMailer::Base
def simple (from, to, subject, body)
from from
recipients to
subject subject
body body
end
end
SimpleMail.deliver_simple('from@from.com', 'to@to.com', 'test', 'this
is a test')
Is that simple. If you need any other thing like attachments, you can
look at the documentation for ActionMailer or ask here.
Good luck,
Jesus.