The SAS Output Delivery System and reporting techniques

Emailing pdf docs via sas

Reply
New Contributor Dvg
New Contributor
Posts: 4

Emailing pdf docs via sas

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

Super Contributor
Posts: 282

Re: Emailing pdf docs via sas

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.

New Contributor Dvg
New Contributor
Posts: 4

Re: Emailing pdf docs via sas

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.Smiley Wink " !!

                  "| 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

Occasional Contributor
Posts: 7

Re: Emailing pdf docs via sas

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

Attachment
Occasional Contributor
Posts: 9

Re: Emailing pdf docs via sas

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

Post a Question
Discussion Stats
  • 4 replies
  • 713 views
  • 3 likes
  • 4 in conversation