how can send email message using ruby?

V

Vellingiri Arul

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.

Thank you

by
vellingiri.
 
M

Mohit Sindhwani

Vellingiri said:
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.

Thank you

by
vellingiri.

You will most likely need to use SMTP. You can have a look at the code
that you'll find online when you search for send email with Ruby. Or
you can take a look at:
http://notepad.onghu.com/2007/3/26/sending-email-with-ruby

You will just need to set your "From" address in the email to be
whatever ID that you want it to be. I'm not sure, though, if Yahoo!
mail will block email from a Yahoo! ID that has not originated from a
yahoo server. You'll just have to try.

For me, I use SMTP and it works fine :)

Cheers,
Mohit.
10/16/2007 | 6:34 PM.
 
J

Jesús Gabriel y Galán

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('(e-mail address removed)', '(e-mail address removed)', '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.
 
V

Vellingiri Arul

Mohit said:
You will most likely need to use SMTP. You can have a look at the code
that you'll find online when you search for send email with Ruby. Or
you can take a look at:
http://notepad.onghu.com/2007/3/26/sending-email-with-ruby

You will just need to set your "From" address in the email to be
whatever ID that you want it to be. I'm not sure, though, if Yahoo!
mail will block email from a Yahoo! ID that has not originated from a
yahoo server. You'll just have to try.

For me, I use SMTP and it works fine :)

Cheers,
Mohit.
10/16/2007 | 6:34 PM.

Hai friend,
I don't understand what they are saying.
They have mentioned the server ,subject and different types of formats.
Please give me the proper example for me.
This is my humble request.kindly help me.

by
vellingiri
 
M

Mohit Sindhwani

Vellingiri said:
Hai friend,
I don't understand what they are saying.
They have mentioned the server ,subject and different types of formats.
Please give me the proper example for me.
This is my humble request.kindly help me.

by
vellingiri
Hi, please explain your question more clearly. I think you asked a
similar question in a separate thread (relating to POP) and I don't know
what you require.

It appears that your concepts on email are not very clear. Please do
read about SMTP and IMAP servers for sending email.

To the best of my knowledge, Yahoo does not let you use/ access their
SMTP servers for free. You will need to sign for some service. To the
best of my knowledge, there's no easy and reliable way to use Yahoo
webmail from a script although some people have tried that. If you sign
up for a service from Yahoo, then you will need to use code similar to
the one I gave (or the ActionMailer example that was posted in response
to mine) - either way, you need to spend some time understanding how
email works and what the protocols mean.

Best Regards
Mohit.
 
V

Vellingiri Arul

Mohit said:
Hi, please explain your question more clearly. I think you asked a
similar question in a separate thread (relating to POP) and I don't know
what you require.

It appears that your concepts on email are not very clear. Please do
read about SMTP and IMAP servers for sending email.

To the best of my knowledge, Yahoo does not let you use/ access their
SMTP servers for free. You will need to sign for some service. To the
best of my knowledge, there's no easy and reliable way to use Yahoo
webmail from a script although some people have tried that. If you sign
up for a service from Yahoo, then you will need to use code similar to
the one I gave (or the ActionMailer example that was posted in response
to mine) - either way, you need to spend some time understanding how
email works and what the protocols mean.

Best Regards
Mohit.

Hi Mohit,
Your program Error:
smtp.rb:1:in 'require': no such file to load -- action_mailer
(LoadError)
from smtp.rb:1
From that I came to know some modules and classes and lib are not
installed.
That's why it was telling error.
In your program is not working properly.It is giving some error.
My question is that using the smtp how can I sen the email to
outside.For exampl,rediff,yahoomail.
we want to require 'net/smtp'
For me also It is working file within intranet.
But it is not going outside email.for that I want to know some knowledge
for sending the outside email.
This is my question.
This is my example:
require 'net/smtp'
from="(e-mail address removed)"
to="(e-mail address removed)"
smtp=Net::smtp::new('192.168.1.1')
email="From :[email protected]\nSubject : Hello\n\n\Hai,this is
wrking wery fine.\n\n"
smtp.start
smtp.sendmail(email,from,to)
smtp.finish

I am not asking only sending email using smtp,other than that any
classes is there.
But smtp is is not working.
You want more explanation for this.

by
vellingiri
 
M

Mohit Sindhwani

Hi. My answers are inline.


Vellingiri said:
Hi Mohit,
Your program Error:
smtp.rb:1:in 'require': no such file to load -- action_mailer
(LoadError)
from smtp.rb:1

OK! My sample actually doesn't use the action_mailer - it was in the
other solution that was proposed to you.
installed.
That's why it was telling error.
In your program is not working properly.It is giving some error.

Same as above.
My question is that using the smtp how can I sen the email to
outside.For exampl,rediff,yahoomail.
we want to require 'net/smtp'
For me also It is working file within intranet.
But it is not going outside email.for that I want to know some knowledge
for sending the outside email.

As I understand it:
1. You have an internal SMTP server that is being used to deliver email.
2. You are using SMTP and it works for internal email addresses.
3. You would like to send email to (e-mail address removed) but that does not work.


If I have understood your problems correctly, it could be a few
problems. Since email sending is working internally using SMTP, I think
your Ruby script is fine.

The problem could be:
1. Your internal SMTP server is not set up properly. For some reason,
it is not relaying messages to outside parties. In this case, email is
not delivered to ANY party outside. This is a configuration problem,
not related to Ruby. Check the documentation for the SMTP server that
you are using.
2. If you are able to send out email to some parties externally, and
specifically NOT to Yahoo or Rediffmail, it could be that the spam
filters at Yahoo, rediff, etc. are blocking your email since it doesn't
appear to be coming from a reputable domain. I don't know much about
this problem, so I can't help.

Perhaps, someone else can be of more use.

Cheers,
Mohit.
10/17/2007 | 3:37 PM.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top