[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

What is wrong in my script?

Ivan Vieira

3/30/2007 9:49:00 PM

require 'net/smtp'

def send_email(from, from_alias, to, to_alias, subject, message)
msg = <<END_OF_MESSAGE
From: #{from_alias} <#{from}>
To: #{to_alias} <#{to}>
Subject: #{subject}

#{message}
END_OF_MESSAGE

Net::SMTP.start("smpt.server", 25) do |smtp|
smtp.send_mail msg, from, to
end
end

send_email("from", "from_alias", "to", "to_alias", "subject", "message")

--
Posted via http://www.ruby-....

2 Answers

Phillip Gawlowski

3/30/2007 10:01:00 PM

0

Ivan Vieira wrote:
> require 'net/smtp'
>
> def send_email(from, from_alias, to, to_alias, subject, message)
> msg = <<END_OF_MESSAGE
> From: #{from_alias} <#{from}>
> To: #{to_alias} <#{to}>
> Subject: #{subject}
>
> #{message}
> END_OF_MESSAGE
>
> Net::SMTP.start("smpt.server", 25) do |smtp|
> smtp.send_mail msg, from, to
> end
> end
>
> send_email("from", "from_alias", "to", "to_alias", "subject", "message")
>

These are wild guess, due to the lack of error messages:
- No authentication provided to the mail server
- The RCPT email doesn't exist
- No HELO provided
- No SMTP server available at the address
- No network connection
- Wrong port

How to ask questions that can be answered in a more helpful manner:
http://www.catb.org/~esr/faqs/smart-ques...

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan....

Rule of Open-Source Programming #8:

Open-Source is not a panacea.

Rick DeNatale

3/30/2007 11:35:00 PM

0

On 3/30/07, Phillip Gawlowski <cmdjackryan@googlemail.com> wrote:
> Ivan Vieira wrote:
> > require 'net/smtp'
> >
> > def send_email(from, from_alias, to, to_alias, subject, message)
> > msg = <<END_OF_MESSAGE
> > From: #{from_alias} <#{from}>
> > To: #{to_alias} <#{to}>
> > Subject: #{subject}
> >
> > #{message}
> > END_OF_MESSAGE
> >
> > Net::SMTP.start("smpt.server", 25) do |smtp|
> > smtp.send_mail msg, from, to
> > end
> > end
> >
> > send_email("from", "from_alias", "to", "to_alias", "subject", "message")
> >
>
> These are wild guess, due to the lack of error messages:
> - No authentication provided to the mail server
> - The RCPT email doesn't exist
> - No HELO provided
> - No SMTP server available at the address
> - No network connection
> - Wrong port

And "from", "from_alias", "to", and "to_alias" don't look like valid
e-mail addresses.

Now can someone please tell me the winning numbers in the next big
powerball lottery?

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denh...