BookmarkSubscribeRSS Feed
cjohnson
Obsidian | Level 7
I am trying to setup email using sas, with no luck. Here is the code I am trying to run:

FILENAME MAIL EMAIL "myemail";
DATA _NULL_;
FILE MAIL;
RUN;


Here is the error I get:

ERROR: Undetermined I/O failure.


I am working in SAS Enterprise 4.1 (SAS 9.1) on a Windows XP machine. Don't know if it matters, but I have MS Office 2007.

I have set the SMTP server and email address in the Options menu. Is there something else I have to do?

Any help is greatly appreciated.

Thanks,
Chris Message was edited by: cjohnson
Christopher Johnson
www.codeitmagazine.com
9 REPLIES 9
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Is it possible that your DATA step failed to write any records to the output destination, resulting in an error condition? Suggest adding a PUT statement with some text output.

Scott Barry
SBBWorks, Inc.
cjohnson
Obsidian | Level 7
Thanks for responding so quickly. I added a Put statement, but still get the same error.

FILENAME MAIL EMAIL "christopher.johnson@brickstreet.com";
DATA _NULL_;
FILE MAIL;
PUT "THIS IS A SAS EMAIL TEST";
RUN;
Christopher Johnson
www.codeitmagazine.com
garybald
Calcite | Level 5
Try putting
run;
between your filename statement and the data _null
cjohnson
Obsidian | Level 7
Tried, but I still get the same error.

FILENAME MAIL EMAIL "christopher.johnson@brickstreet.com";
RUN;
DATA _NULL_;
FILE MAIL;
PUT "THIS IS A SAS EMAIL TEST";
RUN;
Christopher Johnson
www.codeitmagazine.com
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Suggest adding a FILENAME with CLEAR for your used. It's unclear at what point you actually get the error - you may want to open a SAS Support track for this problem.

Also, you may need to verify whether you have sufficient authority on your local machine -- possibly there is some information in your system logs to help debug.

Lastly, you will want to use PROC OPTIONS and verify the SAS CONFIG options for EMAILSYS=, EMAILHOST= and EMAILPORT= on your machine.

Scott Barry
SBBWorks, Inc.
cjohnson
Obsidian | Level 7
Thanks! I set the SMTP server in the SAS Options Menu, but knew there would be more I needed to do. Here are the current settings:

EMAILAUTHPROTOCOL=NONE
Identifies the SMTP e-mail authentication protocol
EMAILHOST=LOCALHOST
SMTP server host for email access method
EMAILID= From E-mail address, log in id, or profile for use with underlying e-mail system
EMAILPORT=25 Port number for SMTP server for email access method
EMAILPW= Used by the E-mail Access Method and Send menu item to set the email session login password for the underlying
e-mail system


Did not see an EMAILSYS option. I checked with IT, and the port is correct. Is there anything else I need to set?

Thanks very much,
Chris Message was edited by: cjohnson
Christopher Johnson
www.codeitmagazine.com
Cynthia_sas
SAS Super FREQ
Hi:

For more information about the "rules" of using the FILENAME EMAIL engine, refer to the Help topic: Sending Electronic Mail from Within the SAS System (EMAIL) or the SAS documentation for your operating system. Note that you may need to change SAS system options related to emailing in order for these techniques to work. Also, if you go to Tech Support and search for the terms 'Email' and 'ODS', there are a lot of hits which describe various issues or troubleshooting tips:

http://support.sas.com/techsup/unotes/SN/013/013786.html
http://support.sas.com/techsup/unotes/SN/009/009243.html
http://support.sas.com/techsup/unotes/SN/009/009459.html
http://support.sas.com/techsup/unotes/SN/005/005334.html
http://support.sas.com/techsup/unotes/SN/005/005335.html
http://support.sas.com/techsup/unotes/SN/016/016339.html
http://support.sas.com/techsup/unotes/SN/013/013503.html
http://support.sas.com/techsup/unotes/SN/018/018363.html

Here are some other useful links:
http://support.sas.com/ctx/samples/index.jsp?sid=464
http://www2.sas.com/proceedings/sugi29/170-29.pdf
http://www2.sas.com/proceedings/sugi29/178-29.pdf

For more help with email issues, your best bet is to contact Tech Support -- since different operating systems require different settings for email to work.

cynthia
Doc_Duke
Rhodochrosite | Level 12
Since you are using EGuide, you could try sending a file using the EGuide tool (right-click on an object, select send, select send as a step in the project). That will use EGuide best-practices to connect to the SMTP gateway. That will help isolate the problem.

Also, I suspect that the SMTP gateway settings in EGuide do not get passed to the SAS server for your code task. You are likely to have to set up the connectivity again within SAS 9.1.

Doc Muhlbaier
Duke
Hobbes
Calcite | Level 5
Try to add the «to=» «type=» and «subject» conditions to the filename declaration.
For example your previous code would change into:

FILENAME MAIL EMAIL to=("christopher.johnson@brickstreet.com")
subject="Test"
type='text';

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
  • 9 replies
  • 2046 views
  • 0 likes
  • 6 in conversation