MAPI Handler to SMTP

ivanlivanl Member Posts: 6
edited 2005-11-10 in Navision Attain
I need to change our bulk email code from MAPI to SMTP. When we send bulk emails from Navision Outlook pops up a message for each email. From what I understand I need to change the code from MAPI to SMTP. Unfortunately I am still learning the code but I need to make the changes.

Can anyone help me with this.

I need to change the code below with SMTP.


NewMessage(ToName : Text[80];CCName : Text[80];Subject : Text[260];Body : Text[260];AttachFileName : Text[260];OpenDialog : Boolean) Ma
IF ISCLEAR(MAPIHandler) THEN
CREATE(MAPIHandler);

ErrorNo := 0;
MAPIHandler.ToName := ToName;
MAPIHandler.CCName := CCName;
MAPIHandler.Subject := Subject;
IF Body <> '' THEN
MAPIHandler.Body := Body;
MAPIHandler.AttachFileName := AttachFileName;
MAPIHandler.OpenDialog := OpenDialog;

MailSent := MAPIHandler.Send;
ErrorNo := MAPIHandler.ErrorStatus;

AddBodyline(TextLine : Text[260]) : Boolean
IF ISCLEAR(MAPIHandler) THEN
CREATE(MAPIHandler);

IF TextLine <> '' THEN
EXIT(MAPIHandler.AddBodyText(TextLine));

Send() MailSent : Boolean
MailSent := MAPIHandler.Send;
ErrorNo := MAPIHandler.ErrorStatus;

GetErrorCode() : Integer
EXIT(MAPIHandler.ErrorStatus);

GetErrorDesc() : Text[260]
EXIT(MAPIHandler.ErrorDescription);

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    You need to use a different automation program to send mails using SMTP.
    You can download some free smtp-mailers or an smtp-ocx from this site to use in Navision:
    SMTP Mail v1.6 - Stabilized
    SMTP OCX v1.6
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • SaalekSaalek Member Posts: 181
    Hi

    You are wrong. MAPI is a DLL which we can use to send mail easyly. SMTP is a mail server.

    Until Navision 4, the mail codeunit (397) use MAPI to send mails. In Navision 4, Navision has created an own DLL called OLHANDLER.DLL who use Microsoft outlook tecnology to send mails.

    The problem about the popup message is not from Navision. The problem is Microsoft Oultlook. Tho avoid spam messages, its security filter are stronger, and you must erase it .There are some posibilities:

    If you are using Navision 3.60,3.70, you don't need to change any code. You must change your Mail client from Microsoft outlook to Microsoft Outlook Express and configure the last one as your default mail app.

    If you are using Navision 4, you must change codeunit 397 and your mail client.

    If you use Exchange server as your mail server (Navision version is not important), you can use security templates to avoid this message. I done it and now works fine. Other people, have some problem with this template and has installed a free program who detects this message and answer it automaticaly. Search in the forum. There are a lot of information

    http://www.mibuso.com/forum/viewtopic.p ... ht=outlook

    Bye
  • ivanlivanl Member Posts: 6
    Thank you for all the replies.

    We have set Outlook Express as our default mail app and unticked the checkbox in Outlook Express (Tools -> Options -> Security -> Warn me when other applications try to send mail as me)

    We are using version Navision Attain 3.10 which should still be similar to 3.6 and 7.
  • ivanlivanl Member Posts: 6
    Hi Everyone,

    The links on previous discussions didn't help me.
    Do I need to change the code unit 397 when we use Outlook Express with a SMTP server on Navision 3.10?
Sign In or Register to comment.