On 02.05.2010 08:58, Toby Rodwell wrote:
> I know the tile doesn't sound very Ruby-related but please bear with me!
> In a Ruby script I make a system call to 'sendmail' to send text from a
> file I've created from a Ruby string (I use sendmail because I don't
> have and cannot easily get 'mail' or other gems added to this machine).

There is net/smtp in the standard library.
http://ruby-doc.org/stdlib/libdoc/net/smtp/rdoc/index.html

> All works fine until I try to to include semi-colons at the end of each
> lne of text, ie "....;\n", at which point sendmail considers these as
> comments, ignores the "\n" newline cahracters, and everything gets
> printed on one line.

What do you mean by "gets printed"?  Last time I checked sendmail was an 
MTA, and MTA's do not print emails.

>  Looking at sendmails manual this seems to be
> expeced behaviour but the odd thing is that if I manually write a test
> file, with 'nano', then the mail is sent, with line breaks as desired,
> no problem.  I also tried a file created by another script (bash I
> think) and that was also OK.  It is almost as if "\n" is not working in
> exactly the same way as a 'return' when writing a text file manually.  I
> also tried "...;\r" instead of "...;\n", with no effect.
> 
> Other wordings which had no effect were "...; \n" and "...;\n ".
> Strangley, "...;\n\n" *did* work, but of course generated an extra blank
> line, which I don't want!
> 
> Any help or advice appreciated.

How exactly do you invoke sendmail (command line arguments) and how do 
you interact with it (writing to stdin, using IO redirection...)?

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/