BookmarkSubscribeRSS Feed
Dvg
Calcite | Level 5 Dvg
Calcite | Level 5

HI

i am having issues opening pdf documents created by ods pdf from emails sent via a sas program. The pdfs are stored remotely on a unix server and i am using standard filename statement to send the email using sas via the unix server.

the problems start when i receive the email and try to open the pdf. I get the following message

'file has been damaged or not properly decoded'.

i Know that sas is creating the files ok as i am able to ftp the file down from the server and open it. So it would appear that the ftp does decode the file but the email service doesnt.

has anyone experienced similar issues?

thanks

4 REPLIES 4
Amir
PROC Star

Hi,

Does the following help?:

12563 - PDF file created by Enterprise Guide is corrupted and unable to openin Acrobat

I did also see the following which mentions a similar issue, but it was on Mainframe, as opposed to Unix:

https://communities.sas.com/thread/5085?start=0&tstart=0

Regards,

Amir.

Dvg
Calcite | Level 5 Dvg
Calcite | Level 5

HI amir

some useful information, thanks.

unfortunately this did not solve my problem. This does though

    %let path=/home;

    %let pdf_name=report1.pdf;

    %let pdf_name_in_email=report2.pdf;

    %let email_body_text_file=email_body.txt;

    %let email_from=me@you.com ;

    %let email_to= me@you.com ;

    %let subject=TEST EMAIL;

    data _null_;

      email_cmd = "(uuencode; " !!

                  " uuencode &path./&pdf_name. &pdf_name_in_email.;) " !!

                  "| cat &path./&email_body_text_file. - " !!

                  "| mailx -s '&subject.' -r '&email_from.' &email_to.";

      call symput('email_cmd', email_cmd);

    run;

    %let rc=%sysfunc(system(&email_cmd.));


the last piece i need to figure now is how to change the email type from plain text to html. If you try to attach an html file in the body of the email it just displays the html code rather than the output.


i've tried -a 'content-type:text/html' straight after the mailx command but it doesnt work.


any ideas


thanks

Wizard
Calcite | Level 5

Attached is code I used to email a PDF using UNIX.   This code builds to PDF and then attaches it to an Email Body.

The PDF attachment is built using ODS PDF Command.

Then email is sent via SAS email.    I am not sure it will work with EG.

Michael

cathyhill
Calcite | Level 5

He, Dvg. Have  you tested E-mailing PDF with the code from Wizard? If yes, please share the result with us. Thanks.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1469 views
  • 3 likes
  • 4 in conversation