net/smtp question

T

Torsten Schmidt

------=_Part_4625_19821580.1131791263830
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi @all,

Hi @all,

i have a problem setting the From: Subject: und To: fields with net::SMTP
i followed an example from the docs and also pickaxe_2 book:

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



Output:

Email-Body:
#####
From: Ruby WebCat ALERT
To: Alle-die-es angeht
Subject: Ruby-smtp-TEST
hallo von der Webcat=FCberwachung mit Ruby!


ErrorCode:
404

ErrorMessage:
/notvalidurl
#####

i expected to see the Subject of the message not in the Email-Body, but in
the header to display it in my email-client.


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 =3D <<END_OF_MESSAGE
From: Your Name <[email protected]>
To: Destination Address <[email protected]>
Subject: test message

This is a test message.
END_OF_MESSAGE

Net::SMTP.start('exchange2000', 25) do |smtp|
smtp.send_message msgstr, '(e-mail address removed)', '(e-mail address removed)'
end
--------------



Could i either change the first method to set the subject or the second to
include my variable-values?

I'm just beginning with ruby so any hints are welcome.

Best Regards,

Torsten

------=_Part_4625_19821580.1131791263830--
 

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

Similar Threads


Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,194
Latest member
KarriWhitt

Latest Threads

Top