MAPIHandler.ErrorStatus not resetting.

KyleaKylea Member Posts: 39
edited 2005-12-07 in Navision Attain
Hi all,

I am using mapi handler to send an email containing an EFT PDF notification to a list of vendors from the EFT Transfer module.

Obviously if one of the emails in the list is invalid I do not want the program to stop but instead email the user details of the record that was not sent.

However when the program reads the next record even though there is a valid address the ErrorStatus keeps coming up as an error and not 0. Has anyone encountered this before? :?:


IF EXISTS(TempFileName) THEN BEGIN
IF ISCLEAR(MapiHandler) THEN
CREATE(MapiHandler);

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

AdminAddress := USERID + Text012;
MailSent := MapiHandler.Send;
ErrorNo := MapiHandler.ErrorStatus;

IF ErrorNo <> 0 THEN BEGIN
Body := Text011 + ' ' + RecId;
MapiHandler.Body := Body;
MapiHandler.ToName := AdminAddress;
ErrorNo := 0;
MailSent := MapiHandler.Send;
ErrorNo := MapiHandler.ErrorStatus;
ErrorNo := 0;
END;
EXIT;
END;

Comments

  • Soft_TodSoft_Tod Member Posts: 43
    Hi.

    I would try to recreate the object.
    ErrorNo := MapiHandler.ErrorStatus; 
    IF ErrorNo <> 0 THEN BEGIN 
    [color=red]CLEAR(MapiHandler):
    CREATE(MapiHandler):[/color]
    Body := Text011 + ' ' + RecId; 
    MapiHandler.Body := Body; 
    MapiHandler.ToName := AdminAddress; 
    ErrorNo := 0; 
    MailSent := MapiHandler.Send; 
    
    It is impossible to make anything foolproof, because fools are so ingenious.
  • KyleaKylea Member Posts: 39
    Hi,

    I added the Clear and the recreate and yes it works beautifully. thanks.
Sign In or Register to comment.