Main Page > Browse Categories > Scripts > E-MAIL Script: Sends E-Mail Notification After Running a Profile

E-MAIL Script: Sends E-Mail Notification After Running a Profile

This is a Visual Basic script which sends an e-mail notification after a profile run. You can install this script by following the 5 easy steps below: 

  • Save the ViceVersa PRO E-Mail Script to your ViceVersa "GlobalScripts" folder, under the ViceVersa PRO 2 installation folder (usually 'C:\Program Files\ViceVersa PRO2\GlobalScripts'). If you do not have the GlobalScripts folder, you need to update to the latest version of ViceVersa PRO 2.
  • Open the script with NotePad.
  • Edit the 5 variables at the beginning of the script USERNAME, PASSWORD, FROM_EMAIL, TO_EMAIL , SMTP_EMAIL_SERVER
  • Save the script.
  • Activate the option "Run custom scripts after execution" in the advanced profile settings for all the ViceVersa PRO profiles you want to receive an e-mail for.


  • By default the script will send an email only if an error occurs. You can change this default behavior by setting the variable SEND_EMAIL_ONLY_IFERROR to FALSE. Then the script will always send an e-mail at the end of a profile execution.
  • You need ViceVersa PRO 2 Build 2011 or newer for this script to work.


The following is an example of an e-mail sent by the script.

Result: OK
Profile: My Documents - backup
Exit Code: 0
Source: C:\Documents and Settings\User\My Documents\ | C:\Documents and Settings\User\Desktop\
\\nas\winXP-ibm\My Documents\ | \\nas\winXP-ibm\Desktop\
User: Romeo
Computer Name: IBM-LAPTOP

Backup (Mirror Source to Target)

- Run Summary -
- Added Files - Source: 0 (0) - Target: 163 (16.73MB)
- Updated Files - Source: 0 (0) - Target: 11 (8.02MB)
- Deleted Files - Source: 0 (0) - Target: 0 (0)
- Added Subfolders - Source: 0 - Target: 14
- Deleted Subfolders - Source: 0 - Target: 0
- Archive Information -
- Files Added to Archive - Source: 0 (0) - Target: 10 (7.30MB)
- Files Deleted from Archive - Source: 0 (0) - Target: 2 (8.04KB)

- Final Status -
- Total Files - Source: 2,323 (1.98GB) - Target: 2,323 (1.98GB)
- Excluded Files - Source: 0 (0) - Target: 0 (0)
- Matched Files - Source: 2,323 (1.98GB) - Target: 2,323 (1.98GB)
- Single Files - Source: 0 (0) - Target: 0 (0)
- Newer Files - Source: 0 (0) - Target: 0 (0)
- Older Files - Source: 0 (0) - Target: 0 (0)
- Total Subfolders - Source: 224 - Target: 224
- Excluded Subfolders - Source: 0 - Target: 0
- Matched Subfolders - Source: 224 - Target: 224
- Single Subfolders - Source: 0 - Target: 0

User Comments
Add Comment
DC Nash -  21-May-08
Had issues with the script returning a 800A000D error. Type Mismatch '[string ""]' on line 104

I had to revise a section of line 104 to reflect this...

If SEND_EMAIL_ONLY_IFERROR = "False" Or [exitcode > "0"] Then

After I added the brackets and quotes it sent the email without error.
Luke -  01-Jul-08
Thank you !!!! Worked like a dream!
Tijs -  10-Jul-08
Thank you, worked a charm! E-mail notifications using the GUI would be a nice addition to future versions but this does the trick!
TGRMN Software -  25-Jul-08
Yes, we'll be adding e-mail sending GUI to the profile settings in a future release... we'll also leave scripting available for customers who require full customization. thanks
Dave -  31-Jul-08
Can this be configured to include log file? It is nice to be notified of errors, but would be really nice to know what file(s) caused the errors.
John Henderson -  05-Aug-08
I am getting an ActiveX error trying to send CDO.Message. No further explanation. The log shows the correct email addresses, the correct username & password and the correct SMTP. Is there a specific ActiveX option I need to enable?
TGRMN Software -  06-Aug-08
Do you get an error code?
TGRMN Software -  11-Aug-08
TGRMN Software -  11-Aug-08
Dave, it is currently not possible to include the detailed list of files failing in the e-mail. This is something we plan to add. thanks
Andrew -  02-Sep-08
Is it possible to encrypt the username and password as I cannot have these details in a plain text file?
TGRMN Software -  05-Sep-08
It is possible to encrypt the entire script, by using the Windows Encrypting File System or by protecting access to the script using file permissions.

Encrypting only username and password within the script is not possible.

Add Comment
No attachments

Did this help you?
Yes No

66% found this information useful

Other Options
Printable Version

General Information
No. 67
Author: TGRMN Software

Download ViceVersa
Visit ViceVersa Forum
A printable version of the entire ViceVersa FAQ and Knowledge Base is also available.
For further queries, please contact us by E-Mail at