LUA Email Script Help

You can share your Lua Scripts with everybody here.

LUA Email Script Help

Postby tmays » Fri Jun 15, 2012 4:06 pm

I am working on adding the LUA scripts on fileuploaded events. So far I have this code working:

Code: Select all
if string.find("%PathName","Testing/") then
c_SendMail("tmays@test.com","%FileName has been uploaded","%Name uploaded into %PathName","email.txt","Exchange")
c_SendMail("mays.tj@test.com","A File Posting Notification","Your file %FileName is available for retrieval.","","Exchange")
end


But what I am wanting to do is for the body of the email is to be able to have the script read from a text file instead of having to write the entire content in the code.

For example.
c_SendMail("tmays@test.com","%FileName has been uploaded","readfrom("email.txt"),"Exchange")

Can someone help?


-TJ
tmays
 
posts 4
 
joined Fri Jun 15, 2012 3:59 pm

Re: LUA Email Script Help

Postby FTP » Mon Jun 18, 2012 7:47 am

Code: Select all
local fp = assert(io.open("c:/email.txt", "rb"))
local content = fp:read("*all")
fp:close()
FTP
Site Admin
 
posts 1243
 
joined Tue Sep 29, 2009 6:09 am

Re: LUA Email Script Help

Postby tmays » Mon Jun 18, 2012 12:47 pm

Thanks,

Does this code need to be inserted in the line of code or at the start of the script? Sorry very new to LUA Scripts.
tmays
 
posts 4
 
joined Fri Jun 15, 2012 3:59 pm

Re: LUA Email Script Help

Postby FTP » Mon Jun 18, 2012 2:04 pm

Code: Select all
local fp = assert(io.open("c:/email.txt", "rb"))
local content = fp:read("*all")
fp:close()

c_SendMail("mays.tj@test.com","A File Posting Notification",content,"","Exchange")
FTP
Site Admin
 
posts 1243
 
joined Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron