[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

how can send email message using ruby?

Vellingiri Arul

10/16/2007 10:31:00 AM

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.
--
Posted via http://www.ruby-....

6 Answers

Mohit Sindhwani

10/16/2007 10:35:00 AM

0

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.
>
> 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...

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.



Jesús Gabriel y Galán

10/16/2007 11:08:00 AM

0

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.

Vellingiri Arul

10/16/2007 12:00:00 PM

0

Mohit Sindhwani wrote:
> Vellingiri Arul wrote:
>> 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...
>
> 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
--
Posted via http://www.ruby-....

Mohit Sindhwani

10/17/2007 6:24:00 AM

0

Vellingiri Arul wrote:
> Mohit Sindhwani wrote:
>
>> Vellingiri Arul wrote:
>>
>>> 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...
>>
>> 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
>
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.





Vellingiri Arul

10/17/2007 6:55:00 AM

0

Mohit Sindhwani wrote:
> Vellingiri Arul wrote:
>>> http://notepad.onghu.com/2007/3/26/sending-email...
>>> 10/16/2007 | 6:34 PM.
>>
> 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="vellingiri@bksys.co.in"
to="vellingiri@bkys.co.in"
smtp=Net::smtp::new('192.168.1.1')
email="From :vellingiri@bksys.co.in\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
--
Posted via http://www.ruby-....

Mohit Sindhwani

10/17/2007 7:38:00 AM

0

Hi. My answers are inline.


Vellingiri Arul wrote:
> Mohit Sindhwani wrote:
>
>> Vellingiri Arul wrote:
>>
>>>> http://notepad.onghu.com/2007/3/26/sending-email...
>>>>
>>>>
>> 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.
>>
>>
>
> 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.

> >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.
>

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 someone@yahoo.com 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.