05-09-2017 05:43 PM
I am running Windows Server on an Amazon virtual desktop (AWS). 64 bit dual processors. SAS 64 bit windows server edition.
I need to be able to send emails automatically from sas code. I have it setup for SMTP.
I get the error message connection refused.
Just trying to execute a simple example as follows:
options emailsys=SMTP firstname.lastname@example.org';
filename mailbox email;
file mailbox email@example.com' subject='MAPI test';
email settings in sas set to smtp, localhost, port 25, etc.
I have researched this extensively. I went into my windows registry and there are no software policies set up for outlook, and I don't get a pop up that says another program is trying to send an email. Just that the connection was refused.
05-09-2017 06:00 PM
You might post the exact message, screen capture or if there is any message in the SAS log post that as well along with the code.
I'm going to guess this ends up involving who/what has permissions where.
05-09-2017 06:57 PM
If you have console access to the Windows server, can you try using the Send-MailMessage command in a PowerShell window? That might tell you whether the system is set up for SMTP mail properly to begin with. If you get that working, then you know it's possible to get it working in SAS.
05-10-2017 08:19 AM
I had the same problem when I was running desktop sas on my own personal laptop.
I am running a virtual desktop in the cloud. There is no company, just me as an independent consultant, so no over-arching IT security interference.
There are no software policies in the windows registry. I'm using microsoft outlook, and it is set as the default program. My email is through godaddy, hosted by office365 (outlook.office365.com). I've gone to the settings for my email server with godaddy and outlook365, and there's nothing on the admin page that restricts. I'm not getting a popup that tells me another program is trying to send email. I saw another post that said don't use port 25, use port 2525. I tried both.
I am attaching my screenshots.
05-10-2017 10:11 AM
When sending mail though a provider like Office 365, you probably need to provide some additional authentication and maybe even configure your e-mail provider to allow such programmatic access. After all, you don't want just anyone with your e-mail address and knowledge of a port number to be able to send e-mail on your behalf.
See this blog post for what's required. It specifically talks about Gmail, but the same protocols are probably in place for any tier-1 cloud-based email provider.
05-10-2017 01:21 PM
Ok, so I have made progress on this issue.
I set up a gmail account, and downloaded a free email program (thunderbird). I setup my new gmail on my virtual machine using thunderbird.
I changed thunderbird to default email. Ran my sas email, and it worked perfectly.
I set up my domain on godaddy, and subscribe to office365 exchange. I can set another email up on my company's domain but not run it through office365 (let google host my email). That should solve my problem.
I will post back with results.