Net/smtp question

Torsten Schmidt [mailto:torstello@gmail.com]

#Net::SMTP::start('server', 25) do |smtp|
#smtp.open_message_stream('ruby-smtp@Webcattest',
#[ 'my@email ]
#) do |stream|
#stream.puts "From: hallo@wach.de"
#stream.puts "To: Alle-die-es-angeht"
#stream.puts "Subject: Ruby-smtp-TEST"
#stream.puts "\nhallo von der Webcatüberwachung mit Ruby! \n\n"
#stream.puts "ErrorCode:"
#stream.puts error_code
#stream.puts "\n\nErrorMessage:"
#stream.puts error_message
#end
#end

in windows, i have to replace "puts" with "write" and append all strings i write with "\r\n" and "\n" with "\r\n"

it works (and i also tested your code)

#This method (also from the docs) works (Sets the Subject
#correctly), but
#here i can't put values of variables into the message text (as
#i can see it)

···

#
#--------------
#msgstr = <<END_OF_MESSAGE
#From: Your Name <your@mail.address>
#To: Destination Address <my@email.de>
#Subject: test message
#
#This is a test message.
#END_OF_MESSAGE
#
#Net::SMTP.start('exchange2000', 25) do |smtp|
#smtp.send_message msgstr, 'Ruby-smtp@test.de', 'myname@hallo.de'
#end

yes, you can.

pls, research on "#{}"

eg.

C:\family\ruby>irb
irb(main):001:0> m="botp@my.friend"
=> "botp@my.friend"
irb(main):002:0> string="botp's address is #{m}"
=> "botp's address is botp@my.friend"
irb(main):003:0>

hth.
kind regards -botp

Thanks a lot Botp,

all of this works :slight_smile:

Best Whishes,

Torsten

···

2005/11/12, Peña, Botp <botp@delmonte-phil.com>:

Torsten Schmidt [mailto:torstello@gmail.com]

#Net::SMTP::start('server', 25) do |smtp|
#smtp.open_message_stream('ruby-smtp@Webcattest',
#[ 'my@email ]
#) do |stream|
#stream.puts "From: hallo@wach.de"
#stream.puts "To: Alle-die-es-angeht"
#stream.puts "Subject: Ruby-smtp-TEST"
#stream.puts "\nhallo von der Webcatüberwachung mit Ruby! \n\n"
#stream.puts "ErrorCode:"
#stream.puts error_code
#stream.puts "\n\nErrorMessage:"
#stream.puts error_message
#end
#end

in windows, i have to replace "puts" with "write" and append all strings i
write with "\r\n" and "\n" with "\r\n"

it works (and i also tested your code)

#This method (also from the docs) works (Sets the Subject
#correctly), but
#here i can't put values of variables into the message text (as
#i can see it)
#
#--------------
#msgstr = <<END_OF_MESSAGE
#From: Your Name <your@mail.address>
#To: Destination Address <my@email.de>
#Subject: test message
#
#This is a test message.
#END_OF_MESSAGE
#
#Net::SMTP.start('exchange2000', 25) do |smtp|
#smtp.send_message msgstr, 'Ruby-smtp@test.de', 'myname@hallo.de'
#end

yes, you can.

pls, research on "#{}"

eg.

C:\family\ruby>irb
irb(main):001:0> m="botp@my.friend"
=> "botp@my.friend"
irb(main):002:0> string="botp's address is #{m}"
=> "botp's address is botp@my.friend"
irb(main):003:0>

hth.
kind regards -botp