Attachment in mail

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
krogholm
Posts: 3
Joined: Thu Sep 11 2003

Attachment in mail

Post by krogholm »

Hi

I use the sendmail function to send a mail with an attachment.
Since the name of the attachment is different from time to time, i use a variable to save the path and name of the file, in stead of writing it directly in the sendmail function.
My problem is that whenever i have a file, where the name (-path & -type) is longer than 8 characters, it's not always send.
It's send the first time, but then i have to shorten the filename to 8 characters or less and send a mail, before i again can send a file with a filename, there is longer than 8 characters.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Which version of the PDF Converter are you using?

Please give an example of filenames you are using or the snippet of code you are using so I can check this.

Thanks,
krogholm
Posts: 3
Joined: Thu Sep 11 2003

Post by krogholm »

I use version 2.10e

It always send an e-mail with the filename used in the code. But i would like to use a filename like 'c:\SalesShipment' + "No." + '.pdf', but even 'c:\salesshipment.pdf' fails.

I make the call from a table:
FileName := 'c:\salesshi.pdf';
createPDF.initPDF('', FileName,'','');
createPDF.RUN;
REPORT.RUNMODAL(ReportSelection."Report
ID",FALSE,FALSE,SalesShptHeader);
SalesShptHeader.FIND('-');
contcust.SETRANGE("No.", SalesShptHeader."Sell-to Customer No.");
contcust.SETRANGE("Link to Table", contcust."Link to Table"::Customer);
IF contcust.FIND('-') THEN BEGIN
IF NOT contact.GET(contcust."Contact No.") THEN
ERROR(Text002);
END ELSE
ERROR(Text002);
Subject := 'Sales Shipment ' + "No.";
Body := 'Vedlagt er Sales Shipment ' + SalesShptHeader."No.";
createPDF.initPDF(contact."E-Mail",'',Body,Subject);
createPDF.RUN;
CLEAR(createPDF);

Here is the codeunit that creates and send the PDF file:
OnRun()
IF contactmail = '' THEN
prePDF
ELSE
postPDF;

initPDF(mail : Text[100];filename : Text[250];body : Text[250];subject : Text[250])
contactmail := mail;
IF filename <> '' THEN
name := filename;
IF subject <> '' THEN
subjectmail := subject;
IF body <> '' THEN
bodymail := body;

prePDF()
pdfConverter.DriverInit('Amyuni PDF Converter');
pdfConverter.EnablePrinter(LicenseName,LicenseKey);
pdfConverter.DefaultDirectory := 'c:\';
pdfConverter.FileNameOptions := 1+2;
pdfConverter.DefaultFileName := name;
pdfConverter.SetDefaultPrinter;

postPDF()
pdfConverter.RestoreDefaultPrinter;
pdfConverter.DriverEnd;
IF CONFIRM('Send genereret fil til email:'+contactmail,FALSE) THEN
pdfConverter.SendMail(contactmail,'','',subjectmail,bodymail,name,0);
contactmail := '';
CLEAR(pdfConverter);
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hi,

Please define filename and name as follows:

FileName := 'c:\salesshi.pdf';
Name := 'c:\salesshi.pdf;mytest.pdf';

You need to use FileName when calling DefaultFileName() and Name when calling the SendMail() function.

Hope this helps.
krogholm
Posts: 3
Joined: Thu Sep 11 2003

Post by krogholm »

Yes of course - Thank you very much.
Post Reply