in reply to Re: e-mail with newlines
in thread e-mail with newlines

Thanks for the information about CRLF, but I'm not quite sure how to actually send these characters. Simply sending them in ASCII text as "\015\012" in the e-mail doesn't work, and they are interpreted as that string. I've searched around this and other sites and have found no answer yet. How can I send them so they are interpreted as a CRLF?

Replies are listed 'Best First'.
Re: Re: Re: e-mail with newlines
by castaway (Parson) on Jul 24, 2003 at 06:40 UTC
    That should work.. (It's how CRLF is defined in Socket.pm) - Maybe you should post some of your code so we can see exactly what you're doing?

    C.

      Good idea. Here is the block of code:
      $message =~ s/<REQUEST>/$requests/i; $sitecfg{SUBJECT}=~s/<NAME>/$htmlparams{name}/i; my %mail = ( To => $sitecfg{REMAIL}, From => ($sitecfg{MAILFROM} || $htmlparams{email}), Subject => ($sitecfg{SUBJECT} || "Data Request"), Message => $message, ); $mail{smtp}=[qw(localhost earth.co-ra.com)]; $mail{retries}=$sitecfg{RETRIES}; sendmail(%mail);
      Basically, the code reads a message from a configuration file. In the message read are a few tags, such as <REQUEST>. Before this block, the code gathers some data and puts it in the message with the search/replace command. The message text is something like:
      Here is the data you requested:\015\012<REQUEST>\015\012Data collected + on...
      As I mentioned, when the message arrives in my inbox, the CRLF appears in text as "\015\012"
        Ah, no, you need to use newlines in the file, and substitute with CRLF before sending.. reading in like that will just read them as literal characters:
        $CRLF = "\015\012"; $message =~ s/\n/$CRLF/gs;
        And btw, there are lots of nice templating systems, eg: Text::Template, without creating your own :)

        C.