The SAS Output Delivery System and reporting techniques

Send a report email through gmail in SAS 9.3

Reply
Contributor
Posts: 43

Send a report email through gmail in SAS 9.3

Hi,

I've got SAS 9.3, and I'm writing a job data step which will be scheduled at some time, and I'd like to send a report email at the end of the process.

I'm trying using a gmail account, but as far as I read there is no way to do it because of the gmail ssl protocol.

Is there no way at all? I read that two solutions are upgrading to sas 9.4 (unfortunately we can't) or use the email feature from sas EG (but I need to do it in a data step since the job is scheduled and it is independent of the EG). Should I give up? Are there other solutions?

Thank you very much in advance.

Regards

Valued Guide
Posts: 3,206

Re: Send a report email through gmail in SAS 9.3

The ssl/tls requirement is holding your mail/smtp option off. The most easy circumvention is finding a mail provider not requiring ssl (until 9.4)

---->-- ja karman --<-----
Frequent Contributor
Posts: 117

Re: Send a report email through gmail in SAS 9.3

HI,

try this..

filename sendmail email

            to="xxx@sas.com"

              cc=("xxx@yyy.co.in"

                  "xxxxx@yyyyy.co.in"

                  )        

              bcc="urname@zzz.com"

            from="urname@zzz.com"

            subject="About email"

  attach="/sasdata/test.xls" /*sample attachemnt*/

            type="text/plain";

data _null_;

      file sendmail;

     put "Hi,";

  Put " ";

     put "Email notification:";

  put " ";

  put "Regards,";

  put "urname";

run;

Contributor
Posts: 43

Re: Send a report email through gmail in SAS 9.3

thank you, I tried but I get:

Message(s) received from the pipe command:

/bin/bash: /data/sas/config/Lev1/SASApp/MAPI: No such file or directory

ERROR: Email could not be sent

thank you, I'm trying using an open smtp server on port=25, but I've found out that the sas server is behind a proxy server like 'http:/proxySmiley Tongueort/config.pac'. How can I deal with this new issue?

Thanks a lot

Frequent Contributor
Posts: 117

Re: Send a report email through gmail in SAS 9.3

Can you paste the code which you are trying to create email notification.

Frequent Contributor
Posts: 117

Re: Send a report email through gmail in SAS 9.3

try this ..

#!/bin/bash: /data/sas/config/Lev1/SASApp/MAPI:

Valued Guide
Posts: 3,206

Re: Send a report email through gmail in SAS 9.3

To be able to send mail all conditions outside the SAS environment must be met.

==> Your machine must be able to get to a mail-server not being blocked by firewalls

  • The easiest would be connecting to an existing mail-server within your current environment. Most bigger companies have an existing mail infrastructure.    

          Often it is known as a bulk-mail authorisation. It is locked-down by the wish of preventing spam.

          Your mail guys should be able to tell you.

  • The next option is using an external mail-provider. You are needing one that does not require SSL.

          Often this is locked-down totally with firewall's as the access to an external world would also open up black-hat hack opportunities.

          Your network guys should be able to tell you.

          With a more simple hosting providers usage (like home conenctions) many of the ports like 25 are closed by them but your external connection is open.

          You external mail provider should offer you an other port like 487 (just an exampel) for this.

          You could check this using the telnet client (adres port). It will always fail but the message why it fails is more interesting. Failing by no access (firewall) or wrong protocol (ah,,,, mail should work)     

   

==>  Your mail-protocol should be understood. There are more parameters often needed to  be set. 

     If the one that is offering (SAS) the protocol and the provider are not well cooperating you are into a deadlock.

---->-- ja karman --<-----
Community Manager
Posts: 2,596

Re: Send a report email through gmail in SAS 9.3

Unfortunately, the security protocol that GMail uses is not supported in the FILENAME EMAIL mechanism until SAS 9.4.  You've probably seen these articles, but I'll post for the group:

Chris

Contributor
Posts: 43

Re: Send a report email through gmail in SAS 9.3

Thank you for all your suggestions, unfortunately the sas server machine I'm using is very poorly configured and limited, and I don't have an admin-like access to configure it, so I didn't succeed to do any of the solutions you proposed, also because of the proxy server.

Anyway, I managed it in another "dirty" way: first, I wrote a simple php page hosted on some server which gets the email parameters (recipients, subject, body, ...) through the POST method and send the email; then, in sas code I call such a page using html post (which has also parameters to set the proxy server). Therefore, the sas batch builds the email parameters for the report and passes them to the php page through POST, and the php page gets the parameters and send the report by mail.

I admit it is a little bit twisted, but it works great!

Thank you again for your help.

Regards

Post a Question
Discussion Stats
  • 8 replies
  • 1514 views
  • 0 likes
  • 4 in conversation