Insert recipient address into Outlook from NAV using PDFCreator

Hi

First some technical details:
Windows 2008 R2 Standard Terminal Server
Navision version DK 3.70 (4.0 SP3)
PDFCreator v1.5.0 (GPL Ghostscript 9.05)
Microsoft Office 2010 (32-bit)

My problem is, that when creating an e-mail with attachment through PDFCreator, the e-mail address field is empty. So is there a way to have the e-mail address from Navision insertet in the ‘To’-field in my Outlook? Or are there any issues with Outlook 2010?

What happens when I choose to print is, that I get prompted from PDFCreator what I would like to do. I select ‘E-mail’, the file is saved on my disc, Outlook opens and I can see the attachment and the subject. Only thing missing is the recipient of the message.

I’ve asked our developer what code is running on the report, and here what he said:
EmailBeskrivelse:=‘Fakturanr.: ’ + SalesInvHeader.“No.” +’ / Deres ref.: ‘+SalesHeader.“Your Reference”; {Ordrenr:=“No.”;}
OK := Email.NewMessage(Customer.“E-Mail”,’’,EmailBeskrivelse,SalesHeader.“No.”,‘c:\pdf\dokument.pdf’,TRUE);

As far as I could understand, then the Customer.“E-Mail” command should be the one to insert the e-mail address.

I’m sorry if this question has been answered earlier.

best regards
Stephan

Looks OK to me, but where is the code written to find the customers email.

Ask your developer to debug the code and check the paramater of the Email.NewMessage & the customer email comming from.

Hi

Tanks for your reply. I’ve asked my developer, and he send me the following code, which is called with the e-mail call from Navision:

IF ISCLEAR(MAPIHandler) THEN
CREATE(MAPIHandler);

//Start tilf bc/auo hkc 11/9-09
IF Body <> ‘’ THEN
ordretype:=COPYSTR(Body,1,1);

{IF ordretype = ‘K’ THEN
ordrenr:=COPYSTR(Body,1,6);}

{IF ordretype =‘S’ THEN}
ordrenr:=COPYSTR(Body,1,9);

ErrorNo := 0; //Standard kode

MAPIHandler.ToName := ToName;
MAPIHandler.CCName := CCName;
MAPIHandler.Subject := Subject;
IF (Body <> ‘’) AND (ordretype <> ‘K’) THEN
MAPIHandler.Body := Body;

{iF ordretype = ‘S’ THEN}
BEGIN
MAPIHandler.Body := Subject;
Salgsfaktura.SETCURRENTKEY(Salgsfaktura.“Order No.”);
Salgsfaktura.SETRANGE(Salgsfaktura.“Order No.”,ordrenr);
IF Salgsfaktura.FINDFIRST THEN;
{ Sælgerkode := Salgsfaktura.“Salesperson Code”;}
SalesHeader.SETRANGE(SalesHeader.“No.”,ordrenr);
IF SalesHeader.FINDFIRST THEN;
{ Sælgerkode := SalesHeader.“Salesperson Code”;}
{ IF Sælger.GET(userid) THEN}
IF Bruger.GET(USERID) THEN
BEGIN
AddBodyline(’ ‘);
AddBodyline(’ ‘);
AddBodyline(‘Med venlig hilsen’);
AddBodyline(’ ‘);
AddBodyline(‘DFI-Gruppen A/S’);
AddBodyline(Bruger.Name);
AddBodyline(Bruger.Titel);
AddBodyline(‘Tlf.: 97132000’);
AddBodyline(‘Fax.: 97131433’);
AddBodyline(Bruger.“Direkte tlf”);
AddBodyline(‘Mail:’+’ '+Bruger.“E-Mail”);
END;
END;

IF ordretype = ‘K’ THEN
BEGIN
PurchaseHeader.SETRANGE(PurchaseHeader.“No.”,ordrenr);
IF PurchaseHeader.FINDFIRST THEN;
IF Sælger.GET(PurchaseHeader.“Purchaser Code”) THEN
BEGIN
AddBodyline(’ ‘);
AddBodyline(’ ‘);
AddBodyline(‘Med venlig hilsen’);
AddBodyline(’ ‘);
AddBodyline(Bruger.Name);
AddBodyline(‘DFI-Gruppen A/S’);
AddBodyline(’’);
AddBodyline(’’);
AddBodyline(’’);
AddBodyline(’’);
// AddBodyline(’’);
END;
END;
//SLUT tilf bc/auo hkc 11/9-09

{ErrorNo := 0;Klammet BC HKC d. 11/9-09}

MAPIHandler.AttachFileName := AttachFileName;
MAPIHandler.OpenDialog := OpenDialog;

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

best regards
Stephan

Hi Stephan,

As Manish wrote then it’s more important to know which parameters are sent to the function, rather than just the full code. [:)]

If the ToName variable is empty then the answer is here. So the best thing to get a quick answer is to debug the code by setting a breakpoint in the start of the function. With the debugger the developer can follow how the parameters, including the recipient address, changes in the code.

Hi Erik

Sorry for not getting back to you, but I have not got any answer from our developer. But I will get back again when he does.

best regards

Stephan