DATA Step, Macro, Functions and more

get copy of mail

Posts: 63

get copy of mail

Hello Everyone!

While sending the email through SAS, I am not able to find a copy of sent mail anywhere.

Is there any option or any modification in the below program to locate the sent mail, which mainly required for validation purpose.

Please help.of

FILENAME Mailbox EMAIL  to=("")

Subject="Router configuration"

ATTACH= "C:\a.txt"


FILE Mailbox;

PUT "Hello";


Posts: 1,460

Re: get copy of mail


It might be easier just to cc/bcc yourself.

I think the location of the sent mail depends on how your mail server is set up. 

Are you running this on PC SAS? Or a server? What OS?  That information might help others help you, as well as your settings for emailsys (SMTP?)


Posts: 63

Re: get copy of mail

Thanks for the quick response.

Just like in Microsoft Outlook, while sending an email, a copy of it is automatically stored in the 'sent items' . Is it not possible to get a copy like this as I have no idea how to find.

I am running the tool in the Server.

Posts: 1,460

Re: get copy of mail

SAS is running on a server, right?  Is it a windows server, or a linux server or some other OS?

If you were running PC SAS, it can actually send the emails via Outlook.  But since you're running on a server, and probably one where outlook is not installed, it goes a different route.  The actual route will depend on your OS and how the mail is setup.  Might be something to ask your SAS administrator.

Frequent Contributor
Posts: 83

Re: get copy of mail


I send a daily and weekly email based on a report and had the same issue of it not showing up in my sent items folder of outlook.

I send these reports as a scheduled task so it may differ if you were to send it in a normal SAS session rather than a batch. The thing is if you were to cc yourself on the email (which I do) you will see that the email is actually being sent from "overmar@</computer or server id/> on behalf of", which means that although it is routed through your email, its not really routed through outlook (see below for actual outlook header). So the easiest thing likely is cc yourself on the email so at least you then have a copy of the email being sent.

Frequent Contributor
Posts: 83

Re: get copy of mail

One other thing although this won't get an email into your sent box, you can save the log from the submitted program which will tell you if the email was sent. This is what the log file looked like from the above email:

NOTE: The file TSC is:

      E-Mail Access Device

Message sent

      To:          ""

      Cc:          ""


      Subject:     Tscores for Thursday, Jan 2, 2014

      Attachments: "xxxx.pdf"

NOTE: 9 records were written to the file TSC.

      The minimum record length was 0.

      The maximum record length was 151.

NOTE: The data set WORK.NULL has 1 observations and 0 variables.

NOTE: DATA statement used (Total process time):

      real time           0.81 seconds

      cpu time            0.04 seconds

In the log file if it says "Message Sent" then you can reasonable infer that the message was in fact sent even without a copy of it in sent items.

Trusted Advisor
Posts: 3,215

Re: get copy of mail

Of couse there will be no copy in the "sent items" of your mail-program. 

You are not using that mail-program but instead using the real mail-interface (SMTP).
That copy can only be created if the mail-provider (server proces) handling that mail is doing that for you.

---->-- ja karman --<-----
Ask a Question
Discussion stats
  • 6 replies
  • 4 in conversation