Confirmation email for FileDrop sender

Discussion in 'ActionScripts' started by David, Feb 1, 2020.

  1. David

    David Administrator
    Staff Member

    Joined:
    Dec 1, 2015
    Messages:
    685
    Likes Received:
    15
    Here is an other example of a User delivery Action Script which sends a confirmation email to the FileDrops sender when their files are successfully uploaded on the LF server.
    (Don't mistake this confirmation email with the download receipts which are being sent by LF server after the FileDrop recipient downloads the files)

    This Action script works on LF server v3.3.60 or higher.

    1) Action Script
    Create following Action script named i.e. "notification-email-to-filedrop-sender.rb" in "Admin > Configuration > Action Scripts" settings.
    Code:
    #!/usr/bin/env ruby
    require 'json'
    
    #set LF server senders email address and name
    lfsender="lfserver@domain.com"
    lfname="LiquidFiles"
    
    message_data = JSON.parse(File.read(ARGV[0]))
    filedropsender = message_data["message"]["sender"]
    subject = message_data["message"]["subject"]
    messageid = message_data["message"]["id"]
    filedroprecipients = message_data["message"]["recipients"]
    messagetxt = message_data["message"]["message"]
    
    #Notification email
    %x{/usr/sbin/sendmail -F #{lfname} -f #{lfsender} -t < /usr/bin/cat <<EOF
    Subject: Confirmation: #{subject}
    To:  #{filedropsender}
    
    This notification email confirms only you that your message ID: #{messageid} has been successfully uploaded to #{filedroprecipients}.
    This is not a download receipt.
    
    .
    EOF
    
    }

    2) Script Assignment
    Assign the script "notification-email-to-filedrop-sender.rb" to the required System FileDrop in "Admin > Configuration > Edit" with the "Delivery Action" selector.

    3) Testing
    Open the FileDrop in a browser and drop files. On the email of the sender you should receive that configured confirmation email. If something did not run well the LF appliance would send you an Email with script error.
     

Share This Page