Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Mail Using SMTP Problem
Dhiraj Girdhar
6/14/2007 6:54:00 AM
Hi,
Please help me to resolve the following issue. When i am running
following script after filling all required parameters like mail ID,
SMTP server and port number etc. I am getting follwoing errors, please
tell me the reason of errors.
msgstr = <<END_OF_MESSAGE
From: Your Name <your@mail.address>
To: Destination Address <someone@example.com>
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
Message-Id: <unique.message.id.string@example.com>
This is a test message.
END_OF_MESSAGE
require 'net/smtp'
Net::SMTP.start('your.smtp.server', 25) do |smtp|
smtp.send_message msgstr,
'your@mail.address',
'his_addess@example.com'
end
Errors:
testmail.rb:16: can't find string "END_OF_MESSAGE" anywhere before EOF
testmail.rb:1: syntax error, unexpected $end, expecting tSTRING_CONTENT
or tSTRI
NG_DBEG or tSTRING_DVAR or tSTRING_END
Regards:
Dhiraj
--
Posted via
http://www.ruby-...
.
2 Answers
Daniel Lucraft
6/14/2007 7:05:00 AM
0
Dhiraj Girdhar wrote:
>
> msgstr = <<END_OF_MESSAGE
> From: Your Name <your@mail.address>
>
> This is a test message.
> END_OF_MESSAGE
>
> testmail.rb:16: can't find string "END_OF_MESSAGE" anywhere before EOF
> testmail.rb:1: syntax error, unexpected $end, expecting tSTRING_CONTENT
> or tSTRI
> NG_DBEG or tSTRING_DVAR or tSTRING_END
>
Remove the spaces from in front of the second 'END_OF_MESSAGE'. The end
of a heredoc string has to be right at the start of the line.
Alternatively at the start of the heredoc do:
msgstr = <<-END_OF_MESSAGE
which allows the end of the heredoc to be indented.
best,
Dan
--
Posted via
http://www.ruby-...
.
Dhiraj Girdhar
6/14/2007 7:08:00 AM
0
Daniel Lucraft wrote:
> Dhiraj Girdhar wrote:
>>
>> msgstr = <<END_OF_MESSAGE
>> From: Your Name <your@mail.address>
>>
>> This is a test message.
>> END_OF_MESSAGE
>>
>> testmail.rb:16: can't find string "END_OF_MESSAGE" anywhere before EOF
>> testmail.rb:1: syntax error, unexpected $end, expecting tSTRING_CONTENT
>> or tSTRI
>> NG_DBEG or tSTRING_DVAR or tSTRING_END
>>
>
> Remove the spaces from in front of the second 'END_OF_MESSAGE'. The end
> of a heredoc string has to be right at the start of the line.
>
> Alternatively at the start of the heredoc do:
> msgstr = <<-END_OF_MESSAGE
> which allows the end of the heredoc to be indented.
>
> best,
> Dan
Thanks Dan, it is working.
Regards:
Dhiraj
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Mail Using SMTP Problem
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password