Mail Using SMTP Problem

D

Dhiraj Girdhar

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 <[email protected]>
To: Destination Address <[email protected]>
Subject: test message
Date: Sat, 23 Jun 2001 16:26:43 +0900
Message-Id: <[email protected]>

This is a test message.
END_OF_MESSAGE

require 'net/smtp'
Net::SMTP.start('your.smtp.server', 25) do |smtp|
smtp.send_message msgstr,
'(e-mail address removed)',
'(e-mail address removed)'
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
 
D

Daniel Lucraft

Dhiraj said:
msgstr = <<END_OF_MESSAGE
From: Your Name <[email protected]>

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
 
D

Dhiraj Girdhar

Daniel said:
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
 

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

Problem with SMTP mail program 3
Simple SMTP server in ruby 2
send email in ruby 12
Using TLS/SSL with Net::SMTP 0
Problems sending mail 0
net/smtp question 0
SMTP SMS Reminder Script 5
net/smtp 6

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top