Help with gsm module | Send SMS when gas is detected

Hi, I'm new to Arduino and I'm having troubles with my code, it reads the gas values fine and the buzzer turns on when the gas value is over 400, my problem is that it doesn't send the SMS like it is supposed to do, I need to solve this issue asap. Thanks in advance.

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);

int buzzer = 12;
int GASA0 = A5;
int gasvalue;

void setup() {
  
 mySerial.begin(9600);
 Serial.begin(9600);
 pinMode(buzzer, OUTPUT); 
 delay(500);     
}

void loop() {
  int analogSensor = analogRead(GASA0);
  int gasvalue=(analogSensor);
  Serial.print("Gas: "); 
  Serial.println(gasvalue); 
 delay (500);
   
  if (gasvalue > 400)
  {
    SendTextMessage();
    
    tone(buzzer, 1000);
  }
  else
  {
    noTone(buzzer);
  }
  delay(500);
  }

void SendTextMessage()
{
  mySerial.println("AT+CMGF=1"); //To send SMS
  delay(1000);
  mySerial.println("AT+CMGS=\"+528681566666\"\r");//phone number
  delay(1000);
  mySerial.println("ALERTA: SE HA DETECTADO UNA FUGA DE GAS.");// content of the message
  delay(200);
  mySerial.println((char)26);
  delay(1000);
  
}

I'm using a Sim 800l gsm module and a MQ2 gas sensor

Start with whatever example software you have for the GSM module, and learn how to send a message.

When that works well, apply those skills to the gas sensor problem.

I did but I don´t know what´s wrong with my code since the module works fine

You have not given us any information that will help us decide what the problem is. Please read "How to use this forum" for guidelines on how to get help.

Describe what should happen, and what happens instead.

Post a wiring diagram (hand drawn, not Fritzing).

In the meantime, compare your present code with the example code that works for the GSM module, line by line, to see what is different.

Better yet, take the example code that actually does send a message, and carefully add to it the code that detects the gas levels.

Another thing, do you really want to send a message every 5 seconds or so when the gas levels are high? Because that's what your code tries to do.