Hi Everyone,
I am sending PDF invoice attachment through mail through Bullzip PDF printer.
1. when i am trying in server, its working fine. but
2. when client is sending from his local machine its showing error.
Sometimes its showing:
Error:1.
1. I have created shared path in server side and gave full permission to the user who is testing it.
2. I have installed Bullzip also in client side.
Error:2.
For the above requirement I am using this link as reference:
https://saurav-nav.blogspot.com/2013/08/navision-classic-save-report-in-pdf.html
Below is my code:
1.For creating PDF file:
CreatePDFfile(SalesInvHeader : Record "Sales Invoice Header")
lSalesInvHdr.RESET;
lSalesInvHdr.SETRANGE("No.",SalesInvHeader."No.");
IF lSalesInvHdr.FINDFIRST THEN
IF ISCLEAR (BullZip) THEN
CREATE(BullZip);
year := DATE2DMY(TODAY, 3);
FileName1:='\\10.10.1.21\Temp\' +lSalesInvHdr."No." + '-'+FORMAT(TODAY,0,'<day,2>-<month,2>')+'-'+FORMAT(year)+
FORMAT(TIME,0,'<hour, 2>.<minute,2>.<second,2>')+'-'+'.pdf';
BullZip.Init;
BullZip.LoadSettings;
RunOnceFile:=BullZip.GetSettingsFileName(TRUE);
BullZip.SetValue('Output',FileName1);
BullZip.SetValue('Showsettings','never');
BullZip.SetValue('ShowPDF','no');
BullZip.SetValue(' ShowProgress','no');
BullZip.SetValue(' ShowProgressFinished','no');
BullZip.SetValue('SuppressErrors','yes');
BullZip.SetValue('ConfirmOverWrite','no');
BullZip.WriteSettings(TRUE);
SalesReport.SETTABLEVIEW(lSalesInvHdr);
SalesReport.USEREQUESTFORM(FALSE);
SalesReport.RUNMODAL;
CLEAR(BullZip);
SendMail(lSalesInvHdr."Sell-to Customer No.",FileName1);
ERASE(FileName1);
2. For sending mail with PDF attachment:
SendMail(VAR CUstNo : Code[30];path : Text[250])
Customer.GET(CUstNo);
SMTPSetup.GET;
Customer.TESTFIELD("E-Mail");
SMTPMAil.CreateMessage(SMTPSetup."Send Email Name",SMTPSetup."Email Sender Email",Customer."E-Mail",'Posted Sale Invoice',' ',TRUE);
SMTPMAil.AddCC(Customer."E-Mail");
SLEEP(2*1000);
SMTPMAil.AddAttachment(path);
SMTPMAil.Send;
SO, once more i want to ensure that i am not getting any error from server side(its working fine. ie end user is getting pdf in mail), when client is trying from his local machine then only the above mentioned error is coming.
Please help me regarding this query/issue, i am facing this issue from long time. it will be very very appreciable to help me.
please suggest/guide me, where i am doing wrong or what is missing.
Thanks in Advance;
Mani.
Answers
please suggest me for the above query. it will be very useful for me.....
Thanks,
Mani.
Instead of SLEEP(2*1000) you could try to loop until the the attachment exists.
What version of NAV are you using?
I am using NAV 2009 R2.
Its working fine in server side, PDF is generating and attachment is able to send But issue is generating from client local machine side.
Please guide me, why client is facing the above issue when they are trying from his local machine.Even that particular user has the full permission for that shared path.
Thanks,
Mani.
No,pdf is not created on specific path but message is showing as its generating each time with name(file name) as its showing in first error.
what is the reason, because each and every time its showing with different name as you can see in file name i have added invoice no with date time.
please guide me.
Thanks,
Mani.
I am waiting for response to resolve the above issue.
Please suggest me..
Thanks,
Mani.
I am using classic client only.[2009 R2]
I mean to say that client is trying with his own local machine then they are facing the above issue; if they are trying in server side then its working fine.
Thanks,
Mani.
I am not storing pdf file in shared path, i am generating,sending and cleaned. The reason behind to give shared path in server side to access that file from anywhere ie Either server side or from client's local machine. But, i am not able to clear why from local machine not able to generate.(Or, i mean facing above issue)
As you work alot with bullzip and emails. so, i am requesting you to see once my code please.. and guide me where i am doing wrong.[or, you need more info from my side?]
please guide me.{I am hoping with help of you i can resolve this issue}
Thanks,
Mani.
I tried already with TEMPORARYPATH instead of server shared path, but its not working. Same issue i was facing. And i don't need to save that generated file to shared path, i am using above shared path to access from anywhere.
Thanks,
Mani.
Please guide me further regarding above issue.
Thanks,
Mani.
I am waiting for the response to resolve this issue; please.....
Thanks,
Mani.