GSM Module SMS alert not responding

Hi, I am doing a project which involves a gas detector sending SMS alert if the amount of gas exceeds the threshold. The module I am using is SIM5300E, which is attached to the 5V supply from the Arduino Mega. The code I've gotten does work occasionally but not all the time. The code is shown below:

void SendMessage()
  Serial.println("Sending Alert");
  mySerial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
  delay(1000); // Delay of 1000 milli seconds or 1 second
  mySerial.println("AT+CMGS=\"+65xxxxxxxx\"\r"); // Replace x with mobile number
  mySerial.println("Gas detected. Please evacuate!!");// The SMS text you want to send
  mySerial.println((char)26);// ASCII code of CTRL+Z

However when I tried using the AT command tester, the module does responds without any delay. Can anyone provide me a suggestion to solve this issue I'm facing. Thank you.