Use xlightftp to limit transfer types and send file list emails

Using Xlightftp can achieve a lot of fun features, but the premise is that you have to buy the professional version of xlight.

This article describes how to implement binding domain controller, implement virtual directory, limit upload type (zip) and realize automatic traversal of the file list in the zip package to send emails automatically.

1. Bind the domain controller.

1. Create a virtual server, this step will not be explained in detail

2. Dual-machine virtual machine server, external user authentication

3. Set Active Directory

4. Set domain control related information

5. Set the user ou that can log in to FTP

6. Set the virtual directory and permissions

 

2. Limit upload types

1. Click Access Control List Settings in Files and Directories

2. Set user action related content

3. Set the prohibition first, and then set the permission (I allow files with img suffix here)

 

Third, traverse the files of the compressed package and send emails (use 7z and blat, you need to install it yourself)

1. Select the Files and Directories tab and click Execute programs based on actions on a file Settings

2. Set the script path and parameters

 I named the script here 7z.bat, because the 7z program is used to traverse the compressed package

Parameter 1: Username Parameter 2: Real path Parameter 3: File name

3. Write a script to traverse the compressed package

@echo off
set username=%1     //获取用户名并赋值
set filename=%3     //获取文件名并赋值
set filedate=%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%    //获取当前日期并赋值
"C:\Program Files\7-Zip\7z.exe" l %2/%3 >  d:\imgfile\%username%_%filename%_%filedate%.txt

//执行7z.exe 参数为 l (小写L,参数为遍历) %2/%3为文件所在路径+文件名 > 将遍历信息输出到文件

set [email protected]    //设置发件邮箱
set [email protected]    //设置发件人
set pass=sendpassword     //设置发件邮箱密码
set [email protected]       //设置收件人,多个收件人用逗号(,)隔开,半角逗号
set subj=%username%_%filename%_%filedate%.txt        //设置发件标题
set mail=d:\imgfile\%username%_%filename%_%filedate%.txt    //设置发件内容
set attach=d:\imgfile\%username%_%filename%_%filedate%.txt   //设置附件
set server=mail.xxx.com    //设置邮件服务器,一般为smtp服务器
set debug=-debug -log d:\blat.log -timestamp    //设置日志记录位置

blat %mail% -to %to% -base64 -charset Gb2312 -subject %subj% -attach %attach% -server %server% -f %from% -u %user% -pw %pass% %debug%    //发送邮件,发送邮件使用blat(这是一个第三方程序)

blat download address:

https://sourceforge.net/projects/blat/

Put the downloaded blat.exe in C:\windows\system32.

The mail received is as follows:

At this point, the setting is complete

{{o.name}}
{{m.name}}

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324065005&siteId=291194637