Send email notification

Discuss new features and functions
Posts: 19
Joined: 8 Nov 2018

sagitario

@Squalo: Did you try to put the SyncSettings.ffs_batch in the same folder of the vbscript?

I see in your file <Const BatchFile = "D:\Desktop\SyncSettings.ffs_batch">. I have already have this problem in my vbscript and I can't say you why because vbscript is not my strong. But I just managed to get it to work when I put something like this: <Const BatchFile = "SyncSettings.ffs_batch">

Hope this helps.
Posts: 10
Joined: 15 Nov 2018

Squalo

@Squalo: Did you try to put the SyncSettings.ffs_batch in the same folder of the vbscript?

I see in your file <Const BatchFile = "D:\Desktop\SyncSettings.ffs_batch">. I have already have this problem in my vbscript and I can't say you why because vbscript is not my strong. But I just managed to get it to work when I put something like this: <Const BatchFile = "SyncSettings.ffs_batch">

Hope this helps. sagitario, 19 Nov 2018, 11:05
No way!
I had already tried this way ... the result is always the same!
I don't understand why
Posts: 68
Joined: 13 Aug 2018

TheExpert

Hi all,

today I added an exception handling if there's no GlobalSettings.xml or similar named file defined: If it isn‘t defined the call procedure of FreeFileSync will be changed. I tested the exception handling successfully and hopefully it will also work for you.

And thanks to @timberetta I added the option for a SSL secured SMTP connection. I don't have the possibility to test the SSL encryption for the SMTP connection. Maybe someone else can test it and give feedback if this is working?

You' ll find the new script version here: download/file.php?id=850

Kind Regards

TheExpert
Posts: 68
Joined: 13 Aug 2018

TheExpert

@Squalo: I took a look at your script. Your issue isn't related to the batch file. You set this option with the complete path as it's documented:

" ' SET TO PATH OF [somebatchfile].ffs_batch
' IF BLANK AND NO COMMAND LINE ARGUMENT, THEN SCRIPT EXITS"

At line 465 your script is searching for the LogFolder setting in the batch file. You can define another log file folder for your synchronisation jobs. Then FreeFileSync adds the following line to the batch file: "<LogFolder>D:\LogFiles\FreeFileSync</LogFolder>" (THIS IS AN EXAMPLE!!!).

If you didn't define another log file folder maybe there's no "<LogFolder></LogFolder>" line in your batch file. You can open the batch file with Notepad++ to see if there's such a line or not.

Am I right, that there's no such a line? Then the Mid function uses the wrong string 'coordinates' and can't be executed correctly.
Posts: 10
Joined: 15 Nov 2018

Squalo

@Squalo: I took a look at your script. Your issue isn't related to the batch file. You set this option with the complete path as it's documented:

" ' SET TO PATH OF [somebatchfile].ffs_batch
' IF BLANK AND NO COMMAND LINE ARGUMENT, THEN SCRIPT EXITS"

At line 465 your script is searching for the LogFolder setting in the batch file. You can define another log file folder for your synchronisation jobs. Then FreeFileSync adds the following line to the batch file: "<LogFolder>D:\LogFiles\FreeFileSync</LogFolder>" (THIS IS AN EXAMPLE!!!).

If you didn't define another log file folder maybe there's no "<LogFolder></LogFolder>" line in your batch file. You can open the batch file with Notepad++ to see if there's such a line or not.

Am I right, that there's no such a line? Then the Mid function uses the wrong string 'coordinates' and can't be executed correctly. TheExpert, 19 Nov 2018, 21:29
You are right!! Thank you!
But now another error appears:
line 369
Char 4
Bad file name or number
code 800A0034
I tried:
-default logfolder (C:\Users\xxxx\AppData\Roaming\FreeFileSync\Logs)
-another logfolder (D:\Desktop\Logs)
the script always returns the same error.
Posts: 68
Joined: 13 Aug 2018

TheExpert

@Squalo: Please use the DoDebug option in the script and let it run once again. With this configuration the script shows you a lot of data as dialogue windows when running with wscript or in the command line when starting with cscript.

You should get the output of the log file the script wants to open at line 369. There's something wrong with the logfile. It looks like the file isn't there anymore when the script wants to open it. If you got the log file name the script found then take a look at the log file folder to see if the file is saved in this folder.
Posts: 4
Joined: 19 Nov 2018

ios

Hi,
the VBS-Script works perfect for me, but I have one question.
How can I send the report to more users?
Const MsgTo = "mail@provider.de"

Br
Ingo
Posts: 7
Joined: 29 Apr 2016

timberval

Hi,
the VBS-Script works perfect for me, but I have one question.
How can I send the report to more users?
Const MsgTo = "mail@provider.de"

Br
Ingo ios, 20 Nov 2018, 12:24
I never tried it, but I think you can do:

Const MsgTo = "mail@provider.de;mail2@provide.de"
or
Const MsgTo = "mail@provider.de,mail2@provide.de"
Posts: 10
Joined: 15 Nov 2018

Squalo

@Squalo: Please use the DoDebug option in the script and let it run once again. With this configuration the script shows you a lot of data as dialogue windows when running with wscript or in the command line when starting with cscript.

You should get the output of the log file the script wants to open at line 369. There's something wrong with the logfile. It looks like the file isn't there anymore when the script wants to open it. If you got the log file name the script found then take a look at the log file folder to see if the file is saved in this folder. TheExpert, 20 Nov 2018, 05:36
Well, I had not seen the DoDebug!
I think the problem is with
GetLogFile which returns this string:
<LogFolder>D:\Desktop\Logs</LogFolder>
instead of
D:\Desktop\Logs\FILENAME
I attach my sample batch
<?xml version="1.0" encoding="utf-8"?>
<FreeFileSync XmlType="BATCH" XmlFormat="14">
    <Compare>
        <Variant>TimeAndSize</Variant>
        <Symlinks>Exclude</Symlinks>
        <IgnoreTimeShift/>
    </Compare>
    <Synchronize>
        <Variant>Mirror</Variant>
        <DetectMovedFiles>false</DetectMovedFiles>
        <DeletionPolicy>RecycleBin</DeletionPolicy>
        <VersioningFolder Style="Replace"/>
    </Synchronize>
    <Filter>
        <Include>
            <Item>*</Item>
        </Include>
        <Exclude>
            <Item>\System Volume Information\</Item>
            <Item>\$Recycle.Bin\</Item>
            <Item>\RECYCLE?\</Item>
            <Item>*\desktop.ini</Item>
            <Item>*\thumbs.db</Item>
        </Exclude>
        <TimeSpan Type="None">0</TimeSpan>
        <SizeMin Unit="None">0</SizeMin>
        <SizeMax Unit="None">0</SizeMax>
    </Filter>
    <FolderPairs>
        <Pair>
            <Left>C:\Windows</Left>
            <Right>D:\Desktop\Nuova cartella (4)</Right>
        </Pair>
    </FolderPairs>
    <Errors Ignore="false" Retry="0" Delay="5"/>
    <LogFolder>D:\Desktop\Logs</LogFolder>
    <PostSyncCommand Condition="Completion"/>
    <Batch>
        <ProgressDialog Minimized="false" AutoClose="false"/>
        <ErrorDialog>Show</ErrorDialog>
        <PostSyncAction>None</PostSyncAction>
    </Batch>
</FreeFileSync>
Thanks a lot
Posts: 4
Joined: 19 Nov 2018

ios

Hi,
the VBS-Script works perfect for me, but I have one question.
How can I send the report to more users?
Const MsgTo = "mail@provider.de"

Br
Ingo ios, 20 Nov 2018, 12:24
I never tried it, but I think you can do:

Const MsgTo = "mail@provider.de;mail2@provide.de"
or
Const MsgTo = "mail@provider.de,mail2@provide.de" timberetta, 20 Nov 2018, 13:45
Hi,
it does not work.

Br
Ingo
Posts: 68
Joined: 13 Aug 2018

TheExpert

@Squalo: Please start the script with the DoDebug option.

Here is a sample of one of my synchronisation jobs started from the command line with cscript:
D:\Scripts>cscript FreeFileSync.vbs batchfile "Sicherung Mailserver zu HTPC.ffs_batch"
Microsoft (R) Windows Script Host, Version 5.812
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.

Argument batchfile matches BatchFile
Argument processed: sBatchFile = Sicherung Mailserver zu HTPC.ffs_batch
Executing program: "C:\Program Files\FreeFileSync\FreeFileSync.exe" "Sicherung Mailserver zu HTPC.ffs_batch" "D:\Scripts\GlobalSettings_Verification.xml"
Program execution  start time was 20.11.2018 21:24:50
Program execution completed with exitcode: 0 Synchronization completed successfully
Program execution finish time was 20.11.2018 21:26:23
GetBatchName return value = Sicherung Mailserver zu HTPC
Program elapsed seconds = 93
Elapsed Time String = 1 Minute 33 Seconds
Elapsed Numb String = 00:00 00:01:33
Log File Folder = D:\LogFiles\FreeFileSync
Job Name = Sicherung Mailserver zu HTPC
Sicherung Mailserver zu HTPC 2018-10-21 023001.092.log was created 21.10.2018 01:37:29
Sicherung Mailserver zu HTPC 2018-10-22 023001.033.log was created 22.10.2018 01:32:00
Sicherung Mailserver zu HTPC 2018-10-23 023001.495.log was created 23.10.2018 01:32:13
Sicherung Mailserver zu HTPC 2018-10-24 023001.201.log was created 24.10.2018 01:35:21
Sicherung Mailserver zu HTPC 2018-10-25 023001.371 [Fehler].log was created 25.10.2018 01:30:25
Sicherung Mailserver zu HTPC 2018-10-25 071153.115.log was created 25.10.2018 06:14:24
Sicherung Mailserver zu HTPC 2018-10-26 023001.464.log was created 26.10.2018 01:31:46
Sicherung Mailserver zu HTPC 2018-10-27 023001.299.log was created 27.10.2018 01:31:49
Sicherung Mailserver zu HTPC 2018-10-28 023001.272.log was created 28.10.2018 01:34:38
Sicherung Mailserver zu HTPC 2018-10-29 023001.473.log was created 29.10.2018 02:39:55
Sicherung Mailserver zu HTPC 2018-10-30 023001.472.log was created 30.10.2018 02:31:53
Sicherung Mailserver zu HTPC 2018-10-31 023001.216.log was created 31.10.2018 02:31:53
Sicherung Mailserver zu HTPC 2018-11-01 023001.318.log was created 01.11.2018 02:33:27
Sicherung Mailserver zu HTPC 2018-11-02 023001.307.log was created 02.11.2018 02:38:37
Sicherung Mailserver zu HTPC 2018-11-03 023001.256.log was created 03.11.2018 02:31:46
Sicherung Mailserver zu HTPC 2018-11-04 023001.283.log was created 04.11.2018 02:31:51
Sicherung Mailserver zu HTPC 2018-11-05 023001.254.log was created 05.11.2018 02:31:46
Sicherung Mailserver zu HTPC 2018-11-06 023001.752.log was created 06.11.2018 02:31:58
Sicherung Mailserver zu HTPC 2018-11-07 023001.506.log was created 07.11.2018 02:31:55
Sicherung Mailserver zu HTPC 2018-11-08 023001.435.log was created 08.11.2018 02:31:49
Sicherung Mailserver zu HTPC 2018-11-09 023000.937.log was created 09.11.2018 02:32:08
Sicherung Mailserver zu HTPC 2018-11-10 023000.963.log was created 10.11.2018 02:36:47
Sicherung Mailserver zu HTPC 2018-11-11 023001.008.log was created 11.11.2018 02:43:01
Sicherung Mailserver zu HTPC 2018-11-12 023001.100.log was created 12.11.2018 02:31:55
Sicherung Mailserver zu HTPC 2018-11-13 023000.657.log was created 13.11.2018 02:31:44
Sicherung Mailserver zu HTPC 2018-11-14 023001.287.log was created 14.11.2018 02:31:43
Sicherung Mailserver zu HTPC 2018-11-15 023001.329.log was created 15.11.2018 02:31:59
Sicherung Mailserver zu HTPC 2018-11-16 023001.286.log was created 16.11.2018 02:31:43
Sicherung Mailserver zu HTPC 2018-11-17 023001.280.log was created 17.11.2018 02:32:00
Sicherung Mailserver zu HTPC 2018-11-18 023001.216.log was created 18.11.2018 02:32:21
Sicherung Mailserver zu HTPC 2018-11-19 023001.278.log was created 19.11.2018 02:34:03
Sicherung Mailserver zu HTPC 2018-11-20 023001.350.log was created 20.11.2018 02:37:52
Sicherung Mailserver zu HTPC 2018-11-20 211119.623.log was created 20.11.2018 21:13:16
Sicherung Mailserver zu HTPC 2018-11-20 212451.372.log was created 20.11.2018 21:26:23
GetLogFile return value = D:\LogFiles\FreeFileSync\Sicherung Mailserver zu HTPC 2018-11-20 212451.372.log
GetBatchName return value = Sicherung Mailserver zu HTPC
Attempting Message Send

--------------------------------------------------------------
Subject: FreeFileSync results for batch Sicherung Mailserver zu HTPC
   From: "FreeFileSync@..." <FreeFileSync@...>
     To: "...@..." <...@...>
--------------------------------------------------------------
FreeFileSync batch Sicherung Mailserver zu HTPC running on WIN10SERVER
Synchronization completed successfully

Duration: 1 Minute 33 Seconds



Log File: D:\LogFiles\FreeFileSync\Sicherung Mailserver zu HTPC 2018-11-20 212451.372.log
--------------------------------------------------------------
Sleeping 15 seconds before exiting.
Maybe you can paste the output of your running script here?
Posts: 10
Joined: 15 Nov 2018

Squalo

@TheExpert Sorry, i didn’t explain well.
i enabled dodebug and the error is in GetLogFolder
Executing program: "D:\Program Files\FreeFileSync\FreeFileSync.exe" "D:\Desktop\SyncSettings.ffs_batch" "%appdata%\FreeFileSync\GlobalSettings.xml"
Program execution  start time was 20/11/2018 22:18:23
Program execution completed with exitcode: 3 Synchronization was aborted
Program execution finish time was 20/11/2018 22:18:49
GetBatchName return value = SyncSettings
Program elapsed seconds = 26
Elapsed Time String = 26 Seconds
Elapsed Numb String = 00:00 00:00:26
Log File Folder = D:\Desktop\Logs
Job Name = D:\Desktop\SyncSettings
GetLogFile return value =     <LogFolder>D:\Desktop\Logs</LogFolder>
Scanning Log File
d:\Download\freefilesync.vbs(369, 4) Errore di run-time di Microsoft VBScript: Nome o numero di file non valido
Posts: 68
Joined: 13 Aug 2018

TheExpert

@Squalo: I don't have an idea why the script recognizes
GetLogFile return value =     <LogFolder>D:\Desktop\Logs</LogFolder>
instead of
GetLogFile return value = D:\Desktop\Logs
When you start this synchronization job directly with FreeFileSync, does the job work and is there a log file?

I see that it is aborted:
Program execution completed with exitcode: 3 Synchronization was aborted
Maybe it's also a good idea to download the newest script version and retry it again.
Posts: 10
Joined: 15 Nov 2018

Squalo

When you start this synchronization job directly with FreeFileSync, does the job work and is there a log file? TheExpert, 21 Nov 2018, 05:14
Yes, the job works fine!
I see that it is aborted:
Program execution completed with exitcode: 3 Synchronization was aborted
TheExpert, 21 Nov 2018, 05:14
I stop it to generate errors.
Maybe it's also a good idea to download the newest script version and retry it again. TheExpert, 21 Nov 2018, 05:14
What's the latest version? I use Version: 2018.10.20 - Version 1.13

Now I'll try to set it all up again.
Posts: 7
Joined: 29 Apr 2016

timberval

Hi,
the VBS-Script works perfect for me, but I have one question.
How can I send the report to more users?
Const MsgTo = "mail@provider.de"

Br
Ingo ios, 20 Nov 2018, 12:24
I never tried it, but I think you can do:

Const MsgTo = "mail@provider.de;mail2@provide.de"
or
Const MsgTo = "mail@provider.de,mail2@provide.de" timberetta, 20 Nov 2018, 13:45
Hi,
it does not work.

Br
Ingo ios, 20 Nov 2018, 13:54
Hi ios
it doesn't work: did you receive an error? doesn't work for all address or you receive only one?
I made a test in this way and i received correctly the report for 2 address:
Const MsgTo = "aaaa@xxxxxx.it;bbbb@yyyyyyyyy.it"
Try to test again.
Posts: 68
Joined: 13 Aug 2018

TheExpert

Maybe it's also a good idea to download the newest script version and retry it again. TheExpert, 21 Nov 2018, 05:14
What's the latest version? I use Version: 2018.10.20 - Version 1.13

Now I'll try to set it all up again. Squalo, 21 Nov 2018, 11:51
As written on 19 Nov 2018, there's a new version available. Here's the download link once again: download/file.php?id=850.
Posts: 19
Joined: 8 Nov 2018

sagitario

@sagitario: Did you have a chance to test the SSL connection to your mail server after adding the lines timbretta added in his post above? Is it working? I hope I will have the time to build a new script at this weekend and will then add the SSL feature to the new script version. TheExpert, 14 Nov 2018, 09:05
Yes.. it work.
Posts: 68
Joined: 13 Aug 2018

TheExpert

@Squalo: I was confused today in the early morning. I think I found out the issue.

These outputs of your script are incorrect:
Job Name = D:\Desktop\SyncSettings
GetLogFile return value =     <LogFolder>D:\Desktop\Logs</LogFolder>
They should look like:
Job Name = Sicherung Mailserver zu HTPC
GetLogFile return value = D:\LogFiles\FreeFileSync\Sicherung Mailserver zu HTPC 2018-11-20 212451.372.log
Because of the incorrect job name the script doesn't find a log file. And the job name is a result of the batch file name without the file extension. You are using the complete path of the batch file and this is correct as Lars Beneke as the script originator documented. But the string procedures do not work when configuring the complete path to the batch file.

It looks like you are the first one, who is using different locations for batch files and the script.

Please try the synchronization once again with saving the script in the same location where the batch files are saved and set only the name of the batch file instead of the complete path. With these settings the script should work as expected. Does it work?
Last edited by TheExpert on 21 Nov 2018, 20:19, edited 1 time in total.
Posts: 68
Joined: 13 Aug 2018

TheExpert

@sagitario: Did you have a chance to test the SSL connection to your mail server after adding the lines timbretta added in his post above? Is it working? I hope I will have the time to build a new script at this weekend and will then add the SSL feature to the new script version. TheExpert, 14 Nov 2018, 09:05
Yes.. it work. sagitario, 21 Nov 2018, 15:40
Thank you for testing :-)

After I released a new version of this script on Monday with the SSL encryption option this new script version should work, too.
Posts: 10
Joined: 15 Nov 2018

Squalo

@Squalo: I was confused today in the early morning. I think I found out the issue.

These outputs of your script are incorrect:
Job Name = D:\Desktop\SyncSettings
GetLogFile return value =     <LogFolder>D:\Desktop\Logs</LogFolder>
They should look like:
Job Name = Sicherung Mailserver zu HTPC
GetLogFile return value = D:\LogFiles\FreeFileSync\Sicherung Mailserver zu HTPC 2018-11-20 212451.372.log
Because of the incorrect job name the script doesn't find a log file. And the job name is a result of the batch file name without the file extension. You are using the complete path of the batch file and this is correct as Lars Beneke as the script originator documented. But the string procedures do not work when configuring the complete path to the batch file.

It looks like you are the first one, who is using diferent locations for batch files and the script.

Please try the synchronization once again with saving the script in the same location where the batch files are saved and set only the name of the batch file instead of the complete path. With these settings the script should work as expected. Does it work? TheExpert, 21 Nov 2018, 15:58
I understand where is the problem, but I do not even understand why this error occurs!
I tried latest version 1.14 md5 checksum 8094f2b903ab056cc1a9c8ff39250b35 with same result!
Everytime i reach same results
Job Name = D:\Desktop\SyncSettings
GetLogFile return value =     <LogFolder>D:\Desktop\Logs</LogFolder>
I tried to create new batch, different folder, complete the task correctly (without stop)
Posts: 68
Joined: 13 Aug 2018

TheExpert

@Squalo: Good to hear that it's working now with a new batch file. Maybe there was something incorrect with the old batch file. But I didn't see where the error was.
Posts: 10
Joined: 15 Nov 2018

Squalo

@Squalo: Good to hear that it's working now with a new batch file. Maybe there was something incorrect with the old batch file. But I didn't see where the error was. TheExpert, 21 Nov 2018, 20:19
Unfortunately I never said it works :(
Here
I tried to create new batch, different folder, complete the task correctly (without stop) Squalo, 21 Nov 2018, 17:11
I mean that i tried:
1)Create a new batch
2)Use different folders
3)I let the whole task finish the synchronization
Without results
Posts: 68
Joined: 13 Aug 2018

TheExpert

Where did you save your batch file? And where's your script saved? Both should be saved in the same folder. And the Const BatchFile shouldn't be defined with the path to the batch file. This should work when both files are saved in the same folder.
Posts: 19
Joined: 8 Nov 2018

sagitario

@Squalo I have test the script that you attched and work without any error. I only change the program BatchFile to "FreeFileSync.ffs_batch" and add my email configs.

I think the problem is that you are putting the bat file (if you use), ffs_batch file and vbs in a wrong place. Like TheExpert say you need to put all in the same folder. Because when the vbscript try to find the log file name it get the name of the batch_ffs which is specified and if this name isn't the exact name you will get a error (for example if you put the path before the name or use a path in the bat script). This is my fist mistake... I have to change the way i call the vbscript file so that I have all the files inside de same folder. Like I already say before, I had need to put a bat file outside the folder to call a others bat files inside of different folders where I have different scripts.

I believe that the vbscript can be change so that is locations can be different maybe TheExpert can do something about it in the future. I think that changing the way the vbscript collect the log name (not the log local path) can resolve this problem.

Regards,
Posts: 10
Joined: 15 Nov 2018

Squalo

I solved... TheExpert was right!
Without path of the batch and so the batch in the same folder of vbs, it worked!
Thank you very much to everyone
Posts: 1
Joined: 20 Mar 2019

uaiz

Hi, is it possible to modify the script and send the email only if Errors/Warnings are present?
I'm not a vbs expert... :)
Posts: 68
Joined: 13 Aug 2018

TheExpert

@uaiz: Yes, this is possible but I wouldn't recommend it. You will never know if the sync has been started if there's no message for successful runs.
User avatar
Site Admin
Posts: 7040
Joined: 9 Dec 2007

Zenju

Email notifications are now directly supported with FreeFileSync 10.20!
Posts: 68
Joined: 13 Aug 2018

TheExpert

Email notifications are now directly supported with FreeFileSync 10.20! Zenju, 15 Feb 2020, 09:50
Great :-). Thank you for implementing this feature. You forgot to mention that it's only available in the paid version. And is there a documetation for the configuration of it?
User avatar
Site Admin
Posts: 7040
Joined: 9 Dec 2007

Zenju

Great :-) You forgot to mention that this feature is only available in the paid version. And is there a documetation for the configuration of this? TheExpert, 15 Feb 2020, 10:08
The best part is there's no configuration needed! You just enter the email address in sync cfg, and you're done!

The target audience are users who don't want to (or can't) fiddle with email send scripts. To make this "magic" work with maximum ease of use, I have to offer the FreeFileSync web server resources and reputation for email sending. But this requires that I minimize risk for abuse (e.g. spammers). This makes it a perfect fit for the FreeFileSync Donation edition, and it also only makes sense to offer for this version.