BookmarkSubscribeRSS Feed
georgedascalu
Calcite | Level 5

Hi,

I try to configure mail service in sas viya 4 , to be able to send mails from platform, without the code.

georgedascalu_0-1717745378007.png

 

If I want to send an email by code from a sas program the mail is sent, I used this part of code: 

options emailhost=
(
"smtp.host.com"
STARTTLS auth=LOGIN
id=" mail@xxxx.xxx"
pw="xxxxx" 
port=587
);
filename mymail email "mail@xxxx.xxx"
                subject="My SAS Configuration File";
                 
data _null_;
   file mymail;
   put 'Jim,';
   put 'This is my SAS configuration file.';
   put 'I think you might like the';
   put 'new options I added.';
run;

 

I tried to add the same options in sas.mail, but I think the problem is that I don't know where to add the STARTTLS or auth=LOGIN .

georgedascalu_1-1717745593021.png

 

Can you help me with this problem.

 

Thank you,

George

 

7 REPLIES 7
gwootton
SAS Super FREQ
If you provide a user name and password in your sas.mail configuration, mail should try to use it (auth login).

To set starttls you can add to the sas.mail configuration the custom property mail.smtp.starttls.enable with a value of true.
--
Greg Wootton | Principal Systems Technical Support Engineer
georgedascalu
Calcite | Level 5

Hi @gwootton  thank you for your answer

I added the properties , but i still can not send any email.

georgedascalu_0-1718032132856.png

I have tried even to add at host directly something like this ("smtp.host.com" STARTTLS auth=LOGIN) , with commas without commas, with parenthesis, without parenthesis, and i get the same result.

georgedascalu_1-1718032319396.png

 

 

gwootton
SAS Super FREQ
I don't think you'd need to use the customProperty "auth". I think it will try to use the supplied user ID and password if you give it one.
If mail.smtp.starttls.enable isn't working in custom properties, try adding it in the deprecated "properties" field. (e.g. mail.smtp.starttls.enable=true).
--
Greg Wootton | Principal Systems Technical Support Engineer
georgedascalu
Calcite | Level 5

 

Unfortunately, I reached the same result , the mail was not sent.

Maybe I am missing something, I saw that in the documentation is saying that the email service is restarted, i was looking in Lens to check  if I have any mail service that I could restart ( something like mail-viya) , and I couldn't find a mail service. But here I get a little bit confused why I could send mail from code and not from the application.

gwootton
SAS Super FREQ
If you don't have a sas-mail pod you are likely running a newer release where this functionality was moved to the sas-collaboration pod.

The email filename access method contacts the mail server directly rather than using the mail REST API endpoint, so settings in sas.mail would not apply.

While both should work, you can also try removing the mail.stmp.starttls.enable customProperty and adding one called "TLSPolicy" with a value of "Mandatory".

Either property being set should trigger the use of starttls.
--
Greg Wootton | Principal Systems Technical Support Engineer
georgedascalu
Calcite | Level 5

I found the pod that is responsible for the mail service and I saw that I get an error when I save the mail service.

georgedascalu_0-1718172983129.png

 

I get the same error even after I set the TLSPolicy.

I am starting to think that the problem is not the TLS.

gwootton
SAS Super FREQ
You may want to engage SAS Technical Support for this so we can review the log file.

They might need to take a look at debug level logging of the service during a failure event. You can turn on global debug logging with:

kubectl -n namespace set env deploy/sas-collaboration SAS_LOG_LEVEL=DEBUG

This will trigger the pod to restart with this logging enabled. After reproducing the failure and capturing the log to a file with:

kubectl -n namespace log -l app=sas-collaboration --tail=-1 > sas-collaboration.log

you can run this to remove the debug logging:

kubectl -n namespace set env deploy/sas-collaboration SAS_LOG_LEVEL-
--
Greg Wootton | Principal Systems Technical Support Engineer

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 690 views
  • 0 likes
  • 2 in conversation