[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Sendmail, semicolons and new lines
From:       Toby Rodwell <trodwell () iee ! org>
Date:       2010-05-02 6:58:34
Message-ID: e7d2bea5e6c217f0383590e25912e5e1 () ruby-forum ! com
[Download RAW message or body]

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).

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.  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.
-- 
Posted via http://www.ruby-forum.com/.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic