Home AMX User Forum AMXForums Archive Threads AMX Applications and Solutions

Variable message in iEquipmentMonitor

I have finally convinced a client to allow me a subnet on their network so I can email them those slightly important maintenance thingys etc... ( IT boffins are sure the world will end if an NI 700 gets hold of their server....?! ) anyways.. the emailing part is all good - however I'm having a mental block as to how to make the "message'' part of the email more than a one line sentence? How can I format the message to have multiple lines eg

Projector XX --
Lamp hours - 8888hrs
Filter hours - 8888hrs
Projector XY
Lamp hours - 8888hrs
Filter hours - 8888hrs

Cheers
RN

Comments

  • Spire_JeffSpire_Jeff Posts: 1,917
    Here is a little bit of the code I use:
    DEFINE_CONSTANT
     CHAR sFILENAME_EMAIL[] = 'MSG_ATTACH.TXT'
     CHAR sALARM_COLOR[2][10] = {'blue','red'}
       
    (***********************************************************)
    (*               VARIABLE DEFINITIONS GO BELOW             *)
    (***********************************************************)
    DEFINE_VARIABLE
    //VOLATILE LONG  lPos_MSG
    //VOLATILE SLONG  slReturn_MSG
    //VOLATILE SLONG  slFile_MSG
    //VOLATILE SLONG  slResult_MSG
    //VOLATILE CHAR  sString_MSG[10000]
    VOLATILE CHAR		sLAST_MSG[25]
    VOLATILE CHAR  sSTATUS_EMAIL[10000]
    VOLATILE INTEGER nSEND_EMAILS = 1
    
    VOLATILE INTEGER nIS_DISARMED = 1
    VOLATILE INTEGER HVAC_Mode_State[2] = {1,2}
    
    
    DEFINE_CALL 'EMAIL NOTIFICATION' (CHAR EMAIL_SUBJECT[25])
    {
    STACK_VAR INTEGER x
    STACK_VAR INTEGER pntr
    IF(nSEND_EMAILS and !(sLAST_MSG == EMAIL_SUBJECT))
    {
    	nSEND_EMAILS = 0
    	sLAST_MSG = EMAIL_SUBJECT
    
    	CANCEL_WAIT 'CLEAR LAST MSG'
    
    	WAIT 300 'CLEAR LAST MSG' sLAST_MSG = ''
    	
    	sSTATUS_EMAIL = "'<HTML><HEAD><TITLE>',
    								 EMAIL_SUBJECT,
    								 '</TITLE><STYLE TYPE="text/css"><!--',$0D,$0A,
    								 '.alarm1{ color:',sALARM_COLOR[ALARM_PARTITION_STATE(1)],'; font-size:14pt; font-style:normal; }',
    								 '.alarm2{ color:',sALARM_COLOR[ALARM_PARTITION_STATE(2)],'; font-size:14pt; font-style:normal; }',
    								 '.alarm3{ color:',sALARM_COLOR[ALARM_PARTITION_STATE(3)],'; font-size:14pt; font-style:normal; }',
    								 'H1{color:#3366CC;font-size:16pt;font-style:normal;}',
    								 'BODY{color:blue;font-size:12pt;font-style:normal;}',$0D,$0A,
    								 '--></STYLE></HEAD><BODY><H1>CURRENT OFFICE STATUS</H1>',
    								 '<HR>The Main alarm is currently: <SPAN CLASS="alarm1">',ALARM_PARTITION_STATE_STR(1),'</SPAN><BR>',
    								 '<HR>The Guest alarm is currently: <SPAN CLASS="alarm2">',ALARM_PARTITION_STATE_STR(2),'</SPAN><BR>',
    								 '<HR>The Safe alarm is currently: <SPAN CLASS="alarm3">',ALARM_PARTITION_STATE_STR(3),'</SPAN><BR>',
    								 '<HR>Audio System Overview: ',GET_AUDIO_STATUS_STR(),'<BR><HR>',
    								 'Lighting Overview:',GET_LIGHT_STATUS_STR(),'<BR><HR>',
     								 '<P><HR>Climate Control Overview: ',GET_HVAC_STATUS_STR(),'<BR>',
    								 '<BR><BR><BR>The AMX Processor.</BODY></HTML>'"
    
    								 
    
    			SmtpQueMessage('amx@your_domain.com',
    										'jeff@your_domain.com;Other_guy@your_domain.com',
    										"EMAIL_SUBJECT,' - ',TIME,'(Office) ***AUTOMATED NOTIFICATION***'",
    										sSTATUS_EMAIL,
    										'')
    	
    		WAIT 5 nSEND_EMAILS = 1
    //	}
    }
    ELSE
    {
    	IF(nSEND_EMAILS)
    		SmtpQueMessage('amx@your_domain.com',
    									'programmer@my_domain.com',
    									"EMAIL_SUBJECT,' - ',TIME,'***DUPLICATE****'",
    									sSTATUS_EMAIL,
    									'')
    }		
    	
    
    }
    

    I used to also attach a file with extra info, but at some point, I recall having problems with this, so I stopped sending the file. I also have some protection to prevent email spamming to the client, but it is not very robust :)

    Jeff
Sign In or Register to comment.