<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How do I send an email using PROC LUA? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/756039#M238631</link>
    <description>&lt;P&gt;Tom:&lt;/P&gt;&lt;P&gt;Is what you asked possible?&amp;nbsp; Probably, but even so I ran the exact same code that Patrick tested, just supplied valid email addresses, and still received the errors.&amp;nbsp; Creating the file first doesn't matter when I didn't even try to attach the file yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've given up on this.&amp;nbsp; Since I can just create a macro to do it, that's what I'll do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All:&amp;nbsp; Thanks for trying to help.&amp;nbsp; I know it was an obscure problem.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Jul 2021 20:27:19 GMT</pubDate>
    <dc:creator>James_79</dc:creator>
    <dc:date>2021-07-22T20:27:19Z</dc:date>
    <item>
      <title>How do I send an email using PROC LUA?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/754686#M238048</link>
      <description>&lt;P&gt;I'm trying to send an email using the filename statement and conditionally add an attachment using PROC LUA instead of a macro procedure.&amp;nbsp; However, I run into an issue when executing the filename statement for the email output inside lua.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is some sample code (email addresses changed) that cause this error to show up:&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: No logical assign for filename EMAILOUT.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: No body file. TAGSETS.MSOFFICE2K output will not be created.&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;proc lua;
    submit;
        sas.submit([[
            filename emailOut email 
                to="someone@somewhere.com"
                from=("sender@somewhere.com") 
                subject = "test email"
                content_type="text/html" type="text/html"
            ;
            ods Tagsets.Msoffice2k file=emailout style=HTMLBlue OPTIONS (PAGEBREAK="NO");
            proc odstext;
                p "This is a test";
            run;
            ods Tagsets.Msoffice2k close;
        ]])
    endsubmit;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I cannot seem to figure out how to get this to work while &lt;U&gt;&lt;STRONG&gt;INSIDE&lt;/STRONG&gt;&lt;/U&gt;proc lua.&amp;nbsp; I can set up the emailOut fileref before proc lua and that will work, but then I can't conditionally add an attachment...or can it?&amp;nbsp; Thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 21:00:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/754686#M238048</guid>
      <dc:creator>James_79</dc:creator>
      <dc:date>2021-07-16T21:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I send an email using PROC LUA?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/754707#M238064</link>
      <description>&lt;P&gt;If your goal is just to make the email dynamic, use macro language. Which part of the process needs to be done conditionally?&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jul 2021 05:38:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/754707#M238064</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-07-17T05:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I send an email using PROC LUA?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/754711#M238065</link>
      <description>&lt;P&gt;I don't have&amp;nbsp;tagset Msoffice2k installed so used&amp;nbsp;excelxp instead. Below code works for me - but writes of course the xml to the email body.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc lua;
  submit;
  sas.submit([[
      filename emailOut email 
        to="someone@somewhere.com"
        from=("someone@somewhere.com") 
        subject = "test email"
        content_type="text/html" type="text/html"
        ;
      ods tagsets.excelxp 
        file=emailout 
        style=HTMLBlue 
        ;
        proc odstext;
          p "This is a test";
        run;
      ods tagsets.excelxp  close;
     ]])
  endsubmit;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 17 Jul 2021 07:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/754711#M238065</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-07-17T07:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: How do I send an email using PROC LUA?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/754983#M238194</link>
      <description>I copied this and still get the "No logical assign for filename EMOUTOUT". I'm using SAS 9.04.01M4P110916, btw. I don't think that should matter here, though.</description>
      <pubDate>Mon, 19 Jul 2021 13:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/754983#M238194</guid>
      <dc:creator>James_79</dc:creator>
      <dc:date>2021-07-19T13:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I send an email using PROC LUA?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/754984#M238195</link>
      <description>Yeah, I can do it easily with macro language, I was just trying to do it with Proc Lua, I just like it better. The part that I want to do conditionally is add an attachment.</description>
      <pubDate>Mon, 19 Jul 2021 13:29:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/754984#M238195</guid>
      <dc:creator>James_79</dc:creator>
      <dc:date>2021-07-19T13:29:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I send an email using PROC LUA?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/755013#M238206</link>
      <description>&lt;P&gt;That seems strange. Are you sure there is not some minor difference between the filename statement generated by LUA and what you tested in regular code?&lt;/P&gt;
&lt;P&gt;Is it possible that the way MSOFFICE2K destination creates its files works differently from the other destination that you got to work?&amp;nbsp; For example I think the HTML destination works differently than destinations like XLSX.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It might be that you need to create the file first and then attach it to the email instead of trying to attach via the EMAIL filename engine.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 15:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/755013#M238206</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-19T15:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I send an email using PROC LUA?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/756039#M238631</link>
      <description>&lt;P&gt;Tom:&lt;/P&gt;&lt;P&gt;Is what you asked possible?&amp;nbsp; Probably, but even so I ran the exact same code that Patrick tested, just supplied valid email addresses, and still received the errors.&amp;nbsp; Creating the file first doesn't matter when I didn't even try to attach the file yet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've given up on this.&amp;nbsp; Since I can just create a macro to do it, that's what I'll do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All:&amp;nbsp; Thanks for trying to help.&amp;nbsp; I know it was an obscure problem.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 20:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/756039#M238631</guid>
      <dc:creator>James_79</dc:creator>
      <dc:date>2021-07-22T20:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I send an email using PROC LUA?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/756148#M238690</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/376198"&gt;@James_79&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've done my trial on a laptop with a local SAS installed. When I've executed the code then my antivirus software prompted me that an application is trying to send an email.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So just as an idea: May be when using Lua some antivirus software in your environment blocks the the file - but when using SAS directly then things get through.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 09:01:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-send-an-email-using-PROC-LUA/m-p/756148#M238690</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-07-23T09:01:21Z</dc:date>
    </item>
  </channel>
</rss>

