Alaska Software Inc. - CRLF
Username: Password:
AuthorTopic: CRLF
Adelaide LopesCRLF
on Mon, 08 May 2006 19:19:09 +0100
Hello,


I have a problem when creating mails.
Each mail basically has a subject, email destiny, and a message.
To build the message I do something like:

    cCorpo := "Ex.mo Sr. ou Sra.:" + CRLF ;
            + "" + CRLF ;
            + "Obrigado pela preferncia!" + CRLF ;
            + "Serve a presente para comunicar o seu acesso  rea 
reservada." + CRLF ;
            + "" + CRLF

    cParametros := "mailto:" + cEMail + " ?subject=" + cAssunto + " &body=" 
+ cCorpo


When I call the function that shows/sends the email:

  DllCall( "SHELL32.DLL", DLL_STDCALL, "ShellExecuteA", 
AppDesktop():getHWND() ;
    , "Open", cParametros, NIL, CurDir() )


The next messages apeares:

Ex.mo Sr. ou Sra.:Obrigado pela preferncia!Serve a presente para comunicar 
o seu acesso  rea reservada.


When I was expecting something more like:

Ex.mo Sr. ou Sra.:

Obrigado pela preferncia!
Serve a presente para comunicar o seu acesso  rea reservada.

(...)


Can anyone tell me what am I doing wrong or another way to format the 
message so and get it right?


My best regards,
Adelaide
Hubert Brandel Re: CRLF
on Mon, 08 May 2006 23:07:48 +0200
Adelaide Lopes schrieb:
> Ex.mo Sr. ou Sra.:Obrigado pela preferência!Serve a presente para comunicar 
> o seu acesso à área reservada.
> 
> When I was expecting something more like:
> 
> Ex.mo Sr. ou Sra.:
> 
> Obrigado pela preferência!
> Serve a presente para comunicar o seu acesso à área reservada.
> 

can you translate the error message ?

Bye
Hubert

----------------

Ich empfehle:  www.xbaseforum.de  (in deutsch)

My Homepage:

german  - www.familie-brandel.de/index.htm
english - www.familie-brandel.de/index_e.htm
Phil Ide
Re: CRLF
on Tue, 09 May 2006 01:11:30 +0100
Hubert,

> Adelaide Lopes schrieb:
>> Ex.mo Sr. ou Sra.:Obrigado pela preferência!Serve a presente para comunicar 
>> o seu acesso à área reservada.
>> 
>> When I was expecting something more like:
>> 
>> Ex.mo Sr. ou Sra.:
>> 
>> Obrigado pela preferência!
>> Serve a presente para comunicar o seu acesso à área reservada.
>> 
> 
> can you translate the error message ?

It's not an error message - it's the body of his email message. He embedded
CRLF's in the message, but they have been stripped out when he recieves the
email.

I think the solution might be to http-escape the CRLF's - using %0d%0a.

The reason is that Chr(13) and Chr(10) are both whitespace to http, and have
no special meaning except when the CSS attribute 'white-space' is enabled
(usually only in <pre> tags). However, %0d and %0a do have meaning.

The "mailto:" is an http directive, so the rest of the command is translated
using http rules. However, the MUA obeys rfc822 which requires CRLF.
Therefore, escaping the characters retains their special meaning, so the
mailer sees CRLF.

Regards,

Phil Ide

***************************************
* Xbase++ FAQ, Libraries and Sources: *
* goto: http://www.idep.org.uk/xbase  *
***************************************

If I'm wearing the key to the hero's shackles around my neck and his former
girlfriend now volunteers to become my mistress and we are all alone in my
bedchamber on my bed and she offers me a goblet of wine, I will politely
decline the offer.
          [Things I'd do as an Evil Overlord]
Jose Luis Otermin [Alaska Software]Re: CRLF
on Wed, 10 May 2006 16:34:20 -0300
Oi Adelaide,
Hi Adelaide,

> To build the message I do something like:
>
>     cCorpo := "Ex.mo Sr. ou Sra.:" + CRLF ;
>             + "" + CRLF ;
>             + "Obrigado pela preferncia!" + CRLF ;
>             + "Serve a presente para comunicar o seu acesso  rea
> reservada." + CRLF ;
>             + "" + CRLF
>
>     cParametros := "mailto:" + cEMail + " ?subject=" + cAssunto + "
&body="
> + cCorpo

S tem que mudar:
You should change to:

#define CRLF  %0D%0A

Testa e me disse 
Test and tell 

At logo

Jos Luis Otermin
Suporte Tcnico
--------------------------------------------------------------------
Foros de Usurios: news://news.alaska-software.com
Foros de Usurios na Web: http://news.alaska-software.com
Pgina Web: http://www.alaska-software.com
Base de Conhecimentos na Web: http://www.alaska-software.com/kbase.shtm
Escritrio em Europa: Fax: +49 (0) 61 96 - 77 99 99 23
Escritrio em  USA: Fax: +1 (646) 218 1281
--------------------------------------------------------------------
Ns gostaramos de receb-lo na terceira conferncia de Xbase++ em
Manchester, NH, EUA; Os detalhes esto aqui:
http://www.xbasedevcon.com:8001/
Jose Luis Otermin [Alaska Software]Re: CRLF
on Wed, 10 May 2006 23:17:03 -0300
Adelaide,

This should work fine for you:

//////////////////////////////////////////////////////////////////////

  Copyright:
        Your Copyright goes here., (c) 2000. All rights reserved.

  Contents:
        This is a standard win32 exe.

//////////////////////////////////////////////////////////////////////

#include "Common.ch"
#include "dll.ch"
/* Overloaded AppSys which does nothing
 */
PROCEDURE AppSys

   /* use the ANSI charset by default */
   SET CHARSET TO ANSI

   /* $TODO: create your application container here */
RETURN

/* This is our main procedure
 */
PROCEDURE Main()

   #define CRLF  "%0D%0A"


    cEmail := "teste@seuISP.com"
    cAssunto := "teste"
   /*
    $TODO: create your application logic here
   */
    cCorpo := "Ex.mo Sr. ou Sra.:" + CRLF ;
            + "" + CRLF ;
            + "Obrigado pela preferncia!" + CRLF ;
            + "Serve a presente para comunicar o seu acesso  rea
reservada." + CRLF ;
            + "" + CRLF

    cCorpo := STRTRAN( cCorpo, SPACE(1), "%20" )


    cParametros := "mailto:" + cEMail + " ?subject=" + cAssunto + " &body="
+ cCorpo

    DllCall( "SHELL32.DLL", DLL_STDCALL, "ShellExecuteA",
AppDesktop():getHWND() ;
    , "Open", cParametros, NIL, CurDir() )


RETURN


Saudaes

Jos Luis Otermin
Suporte Tcnico
--------------------------------------------------------------------
Foros de Usurios: news://news.alaska-software.com
Foros de Usurios na Web: http://news.alaska-software.com
Pgina Web: http://www.alaska-software.com
Base de Conhecimentos na Web: http://www.alaska-software.com/kbase.shtm
Escritrio em Europa: Fax: +49 (0) 61 96 - 77 99 99 23
Escritrio em  USA: Fax: +1 (646) 218 1281
--------------------------------------------------------------------
Ns gostaramos de receb-lo na terceira conferncia de Xbase++ em
Manchester, NH, EUA; Os detalhes esto aqui:
http://www.xbasedevcon.com:8001/