Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Carriage Returns????

0 views
Skip to first unread message

Michelle Warner

unread,
Jun 17, 2000, 3:00:00 AM6/17/00
to
I have an interesting problem. I am trying to send email via the
JavaMail API to a SCO Unix machine. The body of the email contains
carriage returns and newlines. When the email reaches the SCO Unix
machine, the carriage returns are newlines. This is causing some
problems for an application which receives the email via a pipe and the
application expects/needs the carriage returns. I am not sure where the
conversion is actually place but when I email the message to myself and
open it with Lotus Notes the carriage returns are present, leading me to
believe the problem is on the SCO Unix side. I checked the mail.cf (I
think that is what it was called) and according to information in a
SendMail book, sendmail should automatically recognize the carriage
returns. Is there something I am missing? I need to keep the carriage
returns. Thanks in advance.

--
Peace,
Michelle

I am too blessed to be stressed.

http://hrdbdy.home.sprynet.com/

ICQ# 17965901 - http://www.icq.com
AOL Screen Name - mdwarne

Per Hedeland

unread,
Jun 18, 2000, 3:00:00 AM6/18/00
to
In article <394C1F53...@sprynet.com> Michelle Warner

<hrd...@sprynet.com> writes:
>I have an interesting problem. I am trying to send email via the
>JavaMail API to a SCO Unix machine. The body of the email contains
>carriage returns and newlines. When the email reaches the SCO Unix
>machine, the carriage returns are newlines.

This is expected behaviour if you send the message in "raw" form: The
SMTP spec says that end-of-line (EOL) should be represented as CRLF "on
the wire", and the sending and receiving systems are expected to
translate from/to the "local EOL convention". The local EOL convention
on Unix is LF only, so the Unix system correctly translates CRLF to LF
at delivery time.

> This is causing some
>problems for an application which receives the email via a pipe and the
>application expects/needs the carriage returns. I am not sure where the
>conversion is actually place but when I email the message to myself and
>open it with Lotus Notes the carriage returns are present,

Presumably you aren't running Lotus Notes on Unix...

> leading me to
>believe the problem is on the SCO Unix side. I checked the mail.cf (I
>think that is what it was called) and according to information in a
>SendMail book, sendmail should automatically recognize the carriage
>returns. Is there something I am missing? I need to keep the carriage
>returns. Thanks in advance.

Well, strictly speaking, if your message should be delivered on Unix
with CRLF-terminated lines, it isn't "text", and thus needs to be
encoded during transmission - you could e.g. use MIME with Content-Type:
application/octet-stream and Content-Transfer-Encoding: Base64 (Quoted-
Printable probably won't cut it as it more or less assumes "text").

This would be rather gross overkill for your problem though - the real
fix would be for your application to follow the conventions on the
system it is running on, and expect (or at least be prepared to deal
with) LF-only line termination. Failing that, you could just reinstate
the CRs before passing the message to it, e.g. by putting

perl -lpe 's/$/\r/'

ahead of it in the pipe. There are other ways to deal with this, but
those I can think of are more complex or intrusive. Bottom line is, it's
a problem with your application and/or the way you are communicationg
with it, not with the mail system.

--Per Hedeland
p...@erix.ericsson.se

0 new messages