The email notification script can be configured to send an email after an upload, download or when the user exceeds the set disk quota. An email server is required to use this script. Because scripts cannot send email by themselves, the Ostrosoft active-x control for sending email is also required. This control is a free download.
YOU NEED THE EMAIL NOTIFICATION SCRIPT IN VERSION 2.9.6.1713 TO USE THIS TUTORIAL. OLDER SCRIPTS DO NOT HAVE ALL THE FEATURES SHOWN IN THIS TUTORIAL!
Before continuing you must download and install
Ostrosoft's SMTP Components
The next task is to enable the scripting system and add the email notify script to the list of enabled scripts. The email notify script is called Email Notify. Select it from the dropdown list and click on the Add Save Changes button. It should look like the image below.
Before the scripts can be used it must be configured. The configuration settings are in the email_notify_config.xml file located in the /scripts folder under the ftp server installation folder. Open the xml file in notepad to edit it.
A note about editing xml files.
- Only modify the text between the quotes.
- Do not use blank values between the quotes.
- Do not remove any of the quotes.
- To test for problems with the xml file after you edit it, double click on the xml file to display it in internet explorer. If it contains errors IE will show where it.
Editing the Email Server configuration.
In this section you will set the IP address of your email server, the email address sending the email and the email address receiving the email.
<SMTP ocx="ostrosoft" server="mailserver.your_domain.com" from="" to=""/>
Replace mailserver.your_domain.com with your ISP email server address. Use 127.0.0.1 if you downloaded and installed Argosoft's email server (it must be running to use the script)
Replace with the sender's email address.
Replace with the recipient's email address.
as an example the test configuration for me would be something like
<SMTP ocx="ostrosoft" server="mail.blackmoonftpserver.com" from="" to=""/>
Email Server Authentication configuration.
Some email servers require you to login with a username and password to be able to send email. Some require that you check your email within a certain time period before you can send email and others automatically allow you to send email based on your IP address or hostname. If you need to authenticate to send email this section will help you with authentication configuration.
<SMTP_AUTH type="login" username="smtp_loginname" password="smtp_loginpassword"/>
type="none" - Your email server does not require you to login to send email.
type="login" - Your email server requires you to login with a username and password to be able to send mail. This is usually your pop3 login name and password.
type="pop3" - Your email server requires you to check your pop3 account before sending email. Set the username and password values accordingly.
If your type="pop3" and your pop3 server has a different address, add pop3server="your pop3 server" to the SMTP_AUTH line.
Sending email after a file is uploaded.
In this section, you will set which events will cause an email to be sent, when the email is sent (immediately or after logout) and whether to operate in test mode. You do not need to modify these settings if you do not want an email to be sent after an upload.
<UPLOADEVENT email_on_error="false" email_on_success="false" test_mode="false" email_after_logout="false"/>
change the values to
<UPLOADEVENT email_on_error="true" email_on_success="true" test_mode="false" email_after_logout="false"/>
The values, email_on_error and email_on_success must be changed to true. If both values are set to false no email is sent. There is currently no way for the server to detect failed uploads so email_on_error isn't very useful.
The value test_mode must be left on false. If it is changed to true, the script will not send email, it will only print out what it is supposed to send in the server GUI logs.
The value email_after_logout should be left on false. When the value is false, the script will send an email immediately after the file is uploaded. If it is set to true, it will only send a list of files that were uploaded after the ftp client logs out of the ftp server.
Sending email after a file is downloaded. In this section, you will set which events will cause an email to be sent, when the email is sent (immediately or after logout) and whether to operate in test mode. You do not need to modify these settings if you do not want an email to be sent after a download.
<DOWNLOADEVENT email_on_error="false" email_on_success="false" test_mode="false" email_after_logout="false"/>
change the values to
<DOWNLOADEVENT email_on_error="true" email_on_success="true" test_mode="false" email_after_logout="false"/>
The values, email_on_error and email_on_success must be changed to true. If both values are set to false no email is sent.
The value test_mode must be left on false. If it is changed to true, the script will not send email, it will only print out what it is supposed to send in the server GUI logs.
The value email_after_logout should be left on false. When the value is false, the script will send an email immediately after the file is uploaded. If it is set to true, it will only send a list of files that were downloaded after the ftp client logs out of the ftp server.
Sending email when the ftp client exceeds his disk quota.
Here, you will edit the settings that control what to do when the user exceeds his disk quota. This applies only to disk quotas and not any other kind of quota. You do not need to modify these settings if you do not want to email when the user exceeds his disk quota.
<QUOTAEVENT email="false" block_transfer="true" test_mode="false"/>
change the values to
<QUOTAEVENT email="true" block_transfer="true" test_mode="false"/>
The value email should be set to true to enable the email on quota event. Set it to false to disable emailing when the disk quota is exceeded.
The value of block_transfer should be set to true if you want to prevent the user from uploading anymore files. Set it to false to allow the user to exceed his disk quota but still send and email informing you of the event.
The value test_mode must be left on false. If it is changed to true, the script will not send email, it will only print out what it is supposed to send in the server GUI logs.
Save your changes after you are done editing the file. Remember to double click on the xml file to open it in internet explorer and verify there are no mistakes.
To test the script, login and perform the appropriate action (exceeding the disk quota, downloading a file or uploading a file)
Troubleshooting.
- Make sure you followed the above tutorial correctly and did not miss anything.
- Double click on the configuration file to open it up in internet explorer. If there is an error IE will display the error.
- Know what your email server requires to send an email. If nothing happens it is usually because your configuration is setup incorrectly.
- Set test_mode="false" to make the script actually send an email. If test_mode="true" the email will not be sent, instead it will be displayed in the server logs.
- Make sure you have the GUI running while testing. Any errors will be displayed in green in the server logs.
- To check if the script sent an email, click on the IP address of the ftp client to view the logs. Email sent messages will be displayed in green.
- If the script is not reporting any errors and is confirming the message has been sent but you are not receiving any email, your email server authentication may be wrong.
- For any other problems email for help.
|