Code unit 'Mail'.

Hi all. Am sending customer statements by email to my clients. My Qs is about the body part of the email.

QS: I need to separate body texts in to paragraps. Am told reference codeunit MAIL.Function=AddBodyLine.

Now how do i manage this? Thanx

Try

AddBodyLine(Line1)

AddBodyLine(Line2)

…so on

So how do i exactly manage this? Have done it this way but am getting ‘Yes’ as my email body. This how the codfes looks like now:

Mail.AddBodyline (STRSUBSTNO(Body,Consultant.Surname,Priority));
Mail.AddBodyline (‘The Log Description is’ + ’ ’ + SupportLog.“Brief Description”);

Plz corrrect the codes

Try ur code

IF ISCLEAR(MAPIHandler) THEN
CREATE(MAPIHandler);
MAPIHandler.ToName:=‘email’;
MAPIHandler.AddBodyText(‘Hello’);
MAPIHandler.AddBodyText(‘World’);
MAPIHandler.OpenDialog := FALSE;

MAPIHandler.Send;

Am still not able to sort out this issue. Have added the above lines of code but am not sure wat to define MAPHandler variable as. Basically this how my codes now noot like. Could u plz assist further.

Subject := ‘Support Log No.’ + ’ ’ + “Support No”;
Body := SupportSetup.“Log Complete Text”;
Body := STRSUBSTNO(Body,Consultant.Surname,Priority) + ’ ’ + ‘The Log Description is’ + ’ ’ + SupportLog.“Brief Description”;

//Mail.AddBodyline (STRSUBSTNO(Body,Consultant.Surname,Priority));
//Mail.AddBodyline (‘The Log Description is’ + ’ ’ + SupportLog.“Brief Description”);

IF ISCLEAR(MAPIHandler) THEN
CREATE(MAPIHandler);
MAPIHandler.ToName:=‘email’;
MAPIHandler.AddBodyText(‘Hello’);
MAPIHandler.AddBodyText(‘World’);
MAPIHandler.OpenDialog := FALSE;

MAPIHandler.Send;

SupportLog.GET (“Support No”);
ContactPersonID := SupportLog.“Contact Person”;

IF CustContacts.GET(“Customer No”,ContactPersonID) THEN BEGIN
IF CustContacts.“Email Address” <> ‘’ THEN BEGIN
EmailAdd := CustContacts.“Email Address”;
IF Mail.NewMessage (EmailAdd, ‘’, Subject, Body, ‘’, FALSE) THEN
MESSAGE (‘Support Log succesfully sent by Email’);
END;
END ;

You will not use Mail codeunit. Just use MAPIHANDLER, take from Mail codeunit.

IF ISCLEAR(MAPIHandler) THEN
CREATE(MAPIHandler);

SupportLog.GET (“Support No”);
ContactPersonID := SupportLog.“Contact Person”;

IF CustContacts.GET(“Customer No”,ContactPersonID) THEN BEGIN
IF CustContacts.“Email Address” <> ‘’ THEN BEGIN
MAPIHandler.ToName:=CustContacts.“Email Address” ;
MAPIHandler.Subject := ‘Support Log No.’ + ’ ’ + “Support No”;
MAPIHandler.AddBodyText(SupportSetup.“Log Complete Text”;);
MAPIHandler.AddBodyText(STRSUBSTNO(Body,Consultant.Surname,Priority) + ’ ’ + ‘The Log Description is’ + ’ ’ + SupportLog.“Brief Description”);
MAPIHandler.OpenDialog := FALSE;

IF MAPIHandler.Send THEN

MESSAGE (‘Support Log succesfully sent by Email’);

END;

END;

MAPIHandler Variable. What am i defining it as? Please can u expain every bit of this.

I understand the MAPIHandler variable is of type automation. BUT whats the subtype???

‘Navision Attain ApplicationHandler’.MAPIHandler

Sure i have managed this but now the problem is one. Its not splitting the paragraphs. Infact in my email body jst above the To:, From:,Subject: , there is this warning massege. Extra Line breaks in this massege were removed. To restore click here. So wen u click its wen the paragraps appear. Can’t it apper automatically and even leave a blank space of like 2 lines before the next paragraps?

Thanx

add MAPIHandler.AddBodyText this with empty line. like

MAPIHandler.AddBodyText(’ ')

It should be splitting the paragraphs and i have check it on my side.

Abusolutely. Thanx men. Its really wonderfull. It took me long but at last managed. Am a happy boy. I appreciate.