On Fri, 22nd Jan 2021 12:20:16 +0530, mike wrote:
Hm. Where to start? In your message Message-ID: <rud3db$ggn$
1...@solani.org>
you used a function name that differs from the program name. (Maybe a
copy/paste error?) But this way, the main function will never be called.
Using OnBeforeSavingMessage will /not/ accomplish, what you have in
mind, because it only fires when saving /incoming/ message to the
Dialog database. It does /not/ work when saving drafts. (Drafts are
saved from editor window as you type and are neither checked nor
altered when saving them without sending.)
You get compile error for the (seemingly identical) OnBeforeSavingMessage
script (compared to OnBeforeSendingMessage), because the latter program
is written to be able to be canceled, while the latter is not. Instead
of using a main function with return value as in OnBeforeSendingMessage,
you need to use a main /procedure/ with OnBeforeSendingMessage:
procedure OnBeforeSavingMessage(var Message: TStringlist; Servername:string; IsEmail: boolean);
And this procedure must /not/ have a line like:
result:=true;
The number
2147483647 is the maximum string length for the copy
function. It prevents buffer overflow. Larger strings will be truncated.
Back to your original question:
What has to be replaced depends on the encoding of your message. The
replacement occurs right before sending. Therefore it is done on the raw
outgoing message (including all headers!!).
To replace the German umlaut "ä" in several encodings, you'd need to
adjust the search/replace strings with sth. like:
s:=stringreplace(s,'ä','ae');
s:=stringreplace(s,'=E4','ae');
s:=StringReplace(s,'=C3=A4','ae');
Be aware, that this kind of alteration on the raw message must only be
used for characters or strings, which may /not/ be found inside the
header texts!! Else, anything can happen: From posting invalid messages
to stray messages reaching the wrong recipient!
On another thought: Maybe you can use the LastMessageCheck script to see,
how the characters are encoded in your outgoing messages. This script
opens a preview of the raw message right before sending (if it included
correctly). In a case of error, you can cancel the sending process. Be
aware, though, that everything written in this message will be lost on
cancel. So you need to start typing from scratch. (Or keep the whole
message in clipboard right before sending.) The (German) download site
for the LastMessageCheck script is:
http://4d.vollmeier.at/scripte/ereignisscripte/onbeforesendingmessage/lastmessagecheck.html
Hopefully, I have addressed all matters...
Bernd