BookmarkSubscribeRSS Feed
Edoedoedo
Pyrite | Level 9

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

8 REPLIES 8
jakarman
Barite | Level 11

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 --<-----
Vish33
Lapis Lazuli | Level 10

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;

Edoedoedo
Pyrite | Level 9

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:/proxy:port/config.pac'. How can I deal with this new issue?

Thanks a lot

Vish33
Lapis Lazuli | Level 10

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

Vish33
Lapis Lazuli | Level 10

try this ..

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

jakarman
Barite | Level 11

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 --<-----
ChrisHemedinger
Community Manager

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

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Edoedoedo
Pyrite | Level 9

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

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
  • 8 replies
  • 2618 views
  • 0 likes
  • 4 in conversation