From: Emiel Romein on
Hi, here a suggestion to enable multiple mail body Lines based on standard
Navision code. (Actually the mail codeunit should be look @. Probably could
use some improvement besides this one. ? <- happy-smile)

The Function NewMessage in codeunit 397, Mail needs an extra parameter
SendDirectly of the type Boolean.

This parameter should be called with TRUE from the following objects:

Table 5080
Form 5148
Codeunit 397, 431, 5052, 5054, 5071, 5073, 5916.

In the function NewMessage in codeunit 397, Mail the following change should
be made:


MailSent := OSendMail.Send;
ErrorNo := OSendMail.ErrorStatus;
OApplication.Logoff;

to


IF SendDirectly THEN BEGIN
MailSent := OSendMail.Send;
ErrorNo := OSendMail.ErrorStatus;
OApplication.Logoff;
END;

Make the following changed to the function AddBodyline in codeunit 397, Mail

A new parameter NewLine of the type Boolean.

And replace the complete code with:

IF ISCLEAR(BSTRConverterBody) THEN
CREATE(BSTRConverterBody);
IF TextLine <>'' THEN BEGIN
IF NewLine THEN BEGIN
CRLF[1] := 13;
CRLF[2] := 10;
BSTRConverterBody.AppendNextStringPortion(CRLF);
END;

BSTRConverterBody.AppendNextStringPortion(TextLine);
END;

OSendMail.Body := BSTRConverterBody;

CRLF is of the type Text length 2

Function Send() in codeunit 397, Mail probably need the following as last
statement:

OApplication.Logoff;

To create a mail with multiple body lines or a text bigger then 1024 use the
following code:

Mail.NewMessage('emiel.romein(a)qurius.nl','','Subject','Body Line
1','',TRUE,FALSE);
Mail.AddBodyline(' Body Line 2',TRUE);
Mail.AddBodyline('',TRUE);
Mail.AddBodyline(' Body Line 3',FALSE);
Mail.AddBodyline(' Body Line 4',TRUE);
Mail.Send;

Hope this help a bit!

Cheer, Emiel Romein

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/Businesssolutions/Community/NewsGroups/dgbrowser/en-us/default.mspx?mid=eea432a7-2b87-4bc7-a953-9c8b390ec593&dg=microsoft.public.navision