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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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