Sample Script (DWS - Send Mail on Specific Day and Time)

Top  Contents  Index 

This sample uses the SENDMAIL command to send email about the call, but only on certain days and times.

 

To customize this, change the constants in the USER PARAMETERS section.

 

 

/////////////////////////////////////////////////////////////////////////////

// This script sends email during the specified times and days

//

// Change values in USER PARAMETERS section as needed.  You must at least

// change FROM_EMAIL and TO_EMAIL.

//

// Please make sure your mail settings are correct on the Mail page of the

// Options window.

//

// 02/13/05 WTR - created

// 03/23/05 WTR - speak

/////////////////////////////////////////////////////////////////////////////

 

//LANGUAGE=DWS

 

/////////////////////////////////////////////////////////////////////////////

// CONSTANTS

//

// Don't change this section

/////////////////////////////////////////////////////////////////////////////

 

const SUNDAY    = 1;

const MONDAY    = 2;

const TUESDAY   = 3;

const WEDNESDAY = 4;

const THURSDAY  = 5;

const FRIDAY    = 6;

const SATURDAY  = 7;

 

 

/////////////////////////////////////////////////////////////////////////////

// USER PARAMETERS

//

// Change these values to match your needs

/////////////////////////////////////////////////////////////////////////////

 

// mail will be sent FROM this address

const FROM_EMAIL = 'myemail@myisp.com';

 

// mail will be sent TO this address

const TO_EMAIL   = 'mycellphone@mycellularprovider.com';

 

// mail will be sent on START_DAY thru STOP_DAY

const START_DAY  = MONDAY;

const STOP_DAY   = FRIDAY;

 

// mail will be sent on START_TIME thru STOP_TIME

const START_TIME = '8 am';

const STOP_TIME  = '5 pm';

 

 

/////////////////////////////////////////////////////////////////////////////

// CODE

//

// Don't change this section

/////////////////////////////////////////////////////////////////////////////

 

Speak('Call from ' + CallInfo.Name);

 

if (DayOfWeek(Date) >= START_DAY)  and (DayOfWeek(Date) <= STOP_DAY) and

 (Time >= StrToTime(START_TIME)) and (Time <= StrToTime(STOP_TIME)) then

begin

Speak('Sending mail');

SendMail(

  FROM_EMAIL,

  TO_EMAIL,

  'Call from ' + CallInfo.Name + ' at ' + CallInfo.Number,

  'Call received on line ' + CallInfo.Line);

end;