Call local variable in c_sendMail

Please post here if you have problems in using Wing FTP Server.
Post Reply
sinha_roop
Posts: 7
Joined: Mon Jul 09, 2012 10:36 am

Call local variable in c_sendMail

Post by sinha_roop »

Thanks for suggesting the below code:
local filepath = "%LastDir"
local filename = string.sub(filepath,string.len(filepath)-string.find(string.reverse(filepath),"/")+2)
Now my question is how can I use filename as a variable in c_sendMail() function.
I have use below code, but this doesn't work.

c_SendMail("rupesh@mysite.com","Any Subject","Any Body - %filename","","smtp_opr")

The above code return %filename itself instead of value of filename.

Please suggest.
FTP
Site Admin
Posts: 2072
Joined: Tue Sep 29, 2009 6:09 am

Re: Call local variable in c_sendMail

Post by FTP »

It should be:

Code: Select all

local filepath = "%LastDir"
local filename = string.sub(filepath,string.len(filepath)-string.find(string.reverse(filepath),"/")+2)
c_SendMail("rupesh@mysite.com","Any Subject","Any Body - "..filename,"","smtp_opr")
sinha_roop
Posts: 7
Joined: Mon Jul 09, 2012 10:36 am

Re: Call local variable in c_sendMail

Post by sinha_roop »

Thanks a lot!

It works successfully.
Post Reply