MAPIHandler

Hi.

im sending mails to multiple persons using MAPIHandler.
Im getting a warning message and i need to give Allow or Deny for each person.
For example if im having 10 persons i need to give allow for all 10 persons.
How to avoid this warning message.
Im using the following code

IF ISCLEAR(MAPIHandler) THEN
CREATE(MAPIHandler);
MAPIHandler.ToName := “Email Id”;
MAPIHandler.Subject := ‘confirmation of Slection’;
MAPIHandler.AddBodyText(‘Dear ‘+Name);
MAPIHandler.AddBodyText(’’);
MAPIHandler.AddBodyText(‘Congratulations!We are glad to inform that u got selected ‘);
MAPIHandler.AddBodyText(’’);
MAPIHandler.AddBodyText(‘Regards’);
MAPIHandler.AddBodyText(‘xx’);
MAPIHandler.AttachFileName := ‘pathname’;
MAPIHandler.OpenDialog := FALSE;
MAPIHandler.Send;
UNTIL NEXT=0;

And if using this code my mail is sent without attachment.
How to attach the document…
Please suggest…

Hmm, the repeat is missing?

You should have a look at the Codeunit397 to see how to send by outlook and prevent the system from asking for confirmation.

Or you have a look at the CU400 on how to send the mail directly with SMTP and not using Outlook.

ya i tried with both the CU397 and CU400

In Mail.newmessage the body message is coming in single line but i want in different lines.

For that i tried AddBodyline also but its coming has a boolean n i dont how to call tat in a Newmessage

In CU400 its giving error in SMTP server setup… and i dont know to configure SMTP sever

I would still suggest that you use the CU400, you just need to put the name of your smtp server into table SMTP Mail Setup.

The name of your SMTP server you can find the outlook account as well. It is just the same. Even when you use EXCHANGE as Mail server you can put the name of your exchange server into that field. Under some circumstances you need to put your username and password into the SMTP Mail setup table as well.

When you use the AddBodyLine in the CU397, you just leave the Body parameter empty (’’). In this case, the system will put the previously added lines to the mail.

The story with the line breaks is:

You can put the line break manually to the body lines you are adding by putting a LF character at the end of the line. For this you define a text variable which you call LF with the size of 1.

LF[1] := 10;
CU397.AddBodyline('Hello'+LF); // This line will create a line break after the word hello.

Hi Thomas,

CU397 is working fine.But i dont understand abt the LF variable like how a text variable is able to introduce a line break.Can u explain …

Then 4 CU400 i tried to give the outlook exxchange server.But im getting error like 0x80040213,transport failed to connect to server.

When you open notepad and write a line, then press enter, the system adds a CRLF (Carriage Return + Line Feed) to the line. This signals the system to do a line break.

The normal ASCII character set consists of 256 characters (from 0 to 255) where a lot of characters below 32 have a special meaning and are mostly non-printable characters and represent a certain action.

For example the character 8 represents a “tab” and character 27 represents the so called “Escape”. The same is valid for character 10 (which is the line feed) and character 13 (which is the carriage return).

Thank you Thomas…

Now everything is working fine…

But i just wanted to know how to avoid that warning message in MAPIHandler …

You cannot avoid that message in the MAPIHandler as long as you are using Outlook. This wanring exists since Outlook 2000 SP3 and is intended to be a protection again mass mail worms (such as you are now programming in NAV [;)]).