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

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.

Replies are listed 'Best First'.
Re: Re: Re: Re: e-mail with newlines
by lpoht (Sexton) on Jul 24, 2003 at 19:09 UTC
    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.