BookmarkSubscribeRSS Feed
skbhardwaj89
Calcite | Level 5

Dear All,


The code is giving connection time out ERROR when i am trying out to send a email to GMAIL server using smtp settings.

please help me out.

the code is as:


options emailsys=SMTP;
options emailport=465;
options emailauthprotocol=NONE;
options emailhost=smtp.gmail.com;
options NOEMAILFROM;
options emailid="skbhardwaj89@gmail.com";
options emailpw="XXXXXXX";
filename outbox email "skbhardwaj89@gmail.com" debug;

data _null_;
file outbox
to=("skbhardwaj89@gmail.com")
subject="My SAS Output"

;

put 'Folks,';
put 'program ran';
put 'It worked great!';
run;

Thanks in advance.

Regards!!

Sandeep Sharma

3 REPLIES 3
jakarman
Barite | Level 11

Does this thread help you?

https://communities.sas.com/thread/48178

---->-- ja karman --<-----
skbhardwaj89
Calcite | Level 5

Thanks Jaap.

Now I change the code and executed it .It basically giving no ERROR in the log and log is reflecting that mail is sent but i didnot receive the mail. Idon't know what is the problem.Please guide

Here is the code:-

%MACRO email(SEmailid);
  FILENAME mymail EMAIL "NULL"
  TO="&SEmailid" ;
 
   data _null_;
    FILE mymail;
put 'Hello!';
run;
%MEND;

data MailDset;
input Email_ID $25.;
datalines;
sandeep52.s@gmail.com
;
run;

OPTIONS MLOGIC MPRINT SYMBOLGEN;
data _null_;
set MailDset;
call symput("V_EMAIL_ID",trim(EMAIL_ID));
run;

DATA _NULL_ ;
  CALL SYMPUT("SEmailid","&V_EMAIL_ID");
 
RUN;

%email(&SEmailid);


jakarman
Barite | Level 11

As you read the other thread....
1/ you have to deal with firewall-s and routers.

2/ conflicting requirements like requirement of ssl (supported starting at 9.4)

You did not get a Syntax Error. That doesn't indicate the processing of sending was succesful.

Do not expect correct error messages or notes of something happening outside the SAS world.

SAS(R) 9.3 System Options: Reference, Second Edition ( EMAILAUTHPROTOCOL= System Option)
I would expect to be set to Yes as SMTP has normally no security by using valdiatied lines/machines (bulk mail).

Google Gmail:

Account must be set open to use IMAP/POP (go to mail-settings)

Checking SSL/TSL What Are the Gmail SMTP Settings? - About Email ...

Gmail is requiring SSL/TLS and SAS is supporting it with 9.4. Do you have 9.4?

---->-- ja karman --<-----

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 3 replies
  • 3964 views
  • 1 like
  • 2 in conversation