SMS WHEN INPUT TRIGGERED

Hi i need some help with my code!!
I want to make a very simple project "loss o voltage detection"

So when i loose the voltage getting an sms notification. I have the arduino UNO, ARDUINO GSMA shield 2 and a 230 volt relay with an NC contact.

So when the 230 Voltage AC drops the NC contact will CLOSE and that shoud give me back an sms.

So the circuit is very simple. I m getting 5V from my arduino board , i m driving them through the NC relay contact and bring it back to an difital Input of my Arduino (lets say Digital Input 12).

The code should send me an sms when 230vAC drops, relay de energize, NC contact CLOSE and finaly the digital input 12 == HIGH in my arduino board

I have two problems yet. The code should send me an sms only once so i put a " while(1) {} " line at the end of my programm to stop the loop.

But what it happens is when i upload my sketch or reset from the board, the digital input 12 became high, the loop give me back an sms and then the loop stops as it should be ,but in my scope not when i m uploading the skecth or resetin but when i loose voltage on the 230V relay.

Here is what i have done yet :

#include <GSM.h>
int led =12;
int val =0;

GSM gsmAccess;
GSM_SMS sms;

void setup()
{
 pinMode (led,INPUT);

 boolean notConnected = true;
  while (notConnected)
 {
   if (gsmAccess.begin() == GSM_READY)
     notConnected = false;
  }

}

void loop()
{
val = digitalRead(led);
digitalWrite(led,val);

if (led,HIGH) {

 char remoteNum[20]="mynumber";
 char txtMsg[200]="SOS loss of voltage";
 sms.beginSMS(remoteNum);
 sms.print(txtMsg);
 sms.endSMS();
while (1) {}
  }

}

HELP HELP HELP !!!! AND HELP

pinMode (led,INPUT);// wrong

You need:
pinMode(led,INPUT_PULLUP);// I guess

Connect relay between GND and this pin.
Check if this pin has pull-up resistor.

And use the Led (dpin 13) to debug it.

I hope you'll add picture(schematic) next time.