Problem with sending a mail

D

Dirk Einecke

Hi.

I've this code:

--------------------------------

#!/usr/bin/ruby
require 'net/smtp'

msg = <<END_OF_MESSAGE
From: Dirk-From <[email protected]>
To: Dirk-To <[email protected]>
Subject: ruby test mail
Date: #{Time.now.strftime("%a, %d %b %Y %H:%M:%S %z %Z")}
Message-Id: <#{"%.8f" % Time.now.to_f}@we-devedge.de>

test text
END_OF_MESSAGE

Net::SMTP.start(server = 'pop3.we-devedge.de', port = 25) {
|smtp|smtp.sendmail(msg, '(e-mail address removed)', '(e-mail address removed)') }

--------------------------------

But I get a error 500
from /usr/lib/ruby/1.6/net/protocol.rb:164:in `conn_command'
from /usr/lib/ruby/1.6/net/smtp.rb:238:in `do_start'
from /usr/lib/ruby/1.6/net/protocol.rb:131:in `start'
from /usr/lib/ruby/1.6/net/protocol.rb:71:in `start'
from mail.rb:15
[Sat Feb 7 23:54:11 2004] [error] [client 80.139.26.35] Premature end
of script headers: /kunden/we-devedge.de/ruby/htdocs/mail.rb

Can anybody help me with this problem?
What can I do?

bye
Dirk Einecke
 
N

Noel Cuillandre

Try this :
smtp = Net::SMTP.new('smtp.we-devedge.de',25)
smtp.start('we-devedge.de')
smtp.ready('(e-mail address removed)', '(e-mail address removed)') do |a|
a.write msg
end
Noel
 
M

Minero Aoki

Hi,

In mail "Problem with sending a mail"
Dirk Einecke said:
I've this code:
Net::SMTP.start(server = 'pop3.we-devedge.de', port = 25) {
|smtp|smtp.sendmail(msg, '(e-mail address removed)', '(e-mail address removed)') }
But I get a error 500

You must send correct HELO domain (default is "localhost.localdomain").
Give 3rd argument of Net::SMTP.start:

Net::SMTP.start('pop3.we-devedge.de', 25, 'pop3.we-devedge.de') {|smtp|
smtp.sendmail(msg, '(e-mail address removed)', '(e-mail address removed)')
}


Regards,
Minero Aoki
 
D

Dirk Einecke

Hi.

Ok - I have fixed my problem and all is fine - for now.
Thank you.

bye
Dirk Einecke
 

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,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top