BookmarkSubscribeRSS Feed
TYT88
Calcite | Level 5

I have written a program to send out email from SAS and it works fine.

My question is why does it only work on my PC? My colleague tried to run SAS program and it finished successfully with no error or warnings but the email was not received by intended recipient.  

 

10 REPLIES 10
yabwon
Onyx | Level 15

Hi @TYT88 ,

 

Could you share some more details about the setup you have to send emails?

Maybe compare your and your colleague setups? 

 

All the best

Bart

 

P.S. Did recipient checked the "spam" folder?

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



TYT88
Calcite | Level 5

All the setup is in the SAS program and we didn't change anything

 

Kalind_Patel
Lapis Lazuli | Level 10

 

Sending email from SAS requires Email Client tools to be installed and configured properly, for eg: Outlook, 
SAS Uses email clients to send an email, there maybe possibility that SAS executed the mail command but an email client tool is not able to send it.
Generally when you run the send email command from SAS, you might get this kind of popup from your outlook application, you have to allow it to allow the SAS to send the email.
2020-01-09_15-37-46.jpg

TYT88
Calcite | Level 5

Outlook is installed and configured

And yes, we both click on Allow

 

Kalind_Patel
Lapis Lazuli | Level 10

If you're getting this popup which means SAS finished it's job, now it's Outlook's responsibility to send it,
Are you able to see the unsent messages in Outbox or Sent Email folder in Outlook?

TYT88
Calcite | Level 5

Not able to see the email in unsent messages in Outbox or Sent Email folder in Outlook

SASKiwi
PROC Star

If it doesn't show in the Sent Email folder then Outlook never sent it.

 

There is obviously something different about the SAS / email setup on the PC where it doesn't work.

 

Please post the program you are using.  

TYT88
Calcite | Level 5

Here is the program with modified email address to hide anonymity


FILENAME output EMAIL
FROM = ("test@mail.com")
SENDER = ("test@mail.com")
TO = (&TOEMAILS)
CC = (&CCEMAILS)
BCC = (&SIM_MEMBERS)
SUBJECT = ("test mail")
CONTENT_TYPE="text/html";
ODS HTML BODY=output options(pagebreak='no') style =MYSTYLE;

PROC ODSTEXT;
P "test mail";
P ' ';
P "xxxx";
P "(For Internal Use only)";
RUN;

PROC TABULATE DATA=table1 FORMAT=COMMA15.;
CLASS location sales;
classlev location/ S={foreground=BLACK BorderWidth=1 background=powderblue FONT_FACE='ARIAL' font_size=8pt VJUST=C width=1.75in};
classlev sales / S={foreground=BLACK BorderWidth=1 BorderrightWidth=7 background= LIGY FONT_FACE='ARIAL' font_size=8pt borderwidth=1 width=1.75in};
VAR &LMMM._Actual &MMM._RunRate Month_Target/ s=[foreground=BLACK BACKGROUND=WHITE BorderWidth=1 background=PAGY FONT_FACE='ARIAL' font_size=8pt FONT_WEIGHT=BOLD width=1in];
VAR Achievement / s=[foreground=BLACK BACKGROUND=WHITE BorderWidth= 1 BorderrightWidth=7 background=PAGY FONT_FACE='ARIAL' font_size=8pt FONT_WEIGHT=BOLD width=1in];
FORMAT location Hcode. sales Vcode.;
TABLE location ='',
sales=''*(&LMMM._Actual*{S=[FONT_FACE='ARIAL' BorderWidth= 1 FOREGROUND=BLACK font_size=8pt]}*SUM=''
&MMM._RunRate*{S=[FONT_FACE='ARIAL' BorderWidth= 1 FOREGROUND=BLACK font_size=8pt]}*SUM=''
Month_Target*{S=[FONT_FACE='ARIAL' BorderWidth= 1 FOREGROUND=BLACK font_size=8pt]}*SUM=''
Achievement*f=pctfmt9.*{S=[FONT_FACE='ARIAL' BorderWidth= 1 fontweight=bold BorderrightWidth=7 BACKGROUND= PCT. FOREGROUND=FONT. font_size=8pt]}*SUM='')
/ BOX={LABEL='XXX' S=[foreground=BLACK background= powderblue FONT_FACE='ARIAL' font_size=10pt font_style=italic borderwidth=1]};
RUN;

PROC ODSTEXT;
P "";
P "Kindly contact XXXX for any enquiries.";
RUN;

ODS _ALL_ CLOSE;
FILENAME output CLEAR;

TYT88
Calcite | Level 5

I found out is because the MS outlook was not open 

Once MS outlook is opened, all the emails sent out 

 

However they are a bunch of HTML tags - what did I do wrong? 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="Generator" content="SAS Software Version 9.4, see www.sas.com">
<meta http-equiv="Content-type" content="text/html; charset=windows-1252">
<title>SAS Output</title>
<style type="text/css">
<!--
.activelink
{
color: #800080;
}
.aftercaption
{

Kalind_Patel
Lapis Lazuli | Level 10

I missed one thing to check, Which emailsys option you're using?

Is it SMTP ot MAPI? You can check it by running this command: 

proc options option=emailhost;run;


IF you're using SMTP option then mostly you'll not get any mails in your outbox or Sent email in Outlook,
Only MAPI method shows an sent emails in outlook,

You can refer this link for more details:
https://serverfault.com/questions/558034/smtp-sent-e-mail-not-copied-to-sent-folder

 

For troubleshoot, you can try with MAPI method instead of SMTP and at at last you can raise a track in SAS Technical Support to investigate further.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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