GSM Sim800L Module fails to send a message

Greetings and salutations,
I am a rookie when it comes to this and I have no prior experience to using the GSM module.

Expectation: Code Runs
Use Serial monitor to get phone number and message to send
It sends “Sent!” to the serial monitor which means it has successfully sent

Reality : Code Runs
Serial monitor works
Sends “Failed” which means it was not able to send the message

Code for the board

#include <SoftwareSerial.h>
#include "Adafruit_FONA.h"

#define FONA_RX 2
#define FONA_TX 3
#define FONA_RST 4

char replybuffer[255];

SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);

Adafruit_FONA fona = Adafruit_FONA(FONA_RST);

uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout = 0);

void setup() {
  while (!Serial);
  Serial.begin(115200);
  Serial.println(F("FONA basic test"));
  Serial.println(F("Initializing....(May take 3 seconds)"));
  fonaSS.begin(4800); 
  if (! fona.begin(fonaSS)) {            
    Serial.println(F("Couldn't find FONA"));
    while (1);
  }
  Serial.println(F("FONA is OK"));

   char sendto[21], message[141];
   flushSerial();
   Serial.print(F("Send to #"));
   readline(sendto, 10);
   Serial.println(sendto);
   Serial.print(F("Type out one-line message (140 char): "));
   readline(message, 20);
   Serial.println(message);
   if (!fona.sendSMS(sendto, message)) {
      Serial.println(F("Failed"));
   } else {
      Serial.println(F("Sent!"));
   }
}

void loop() {}

void flushSerial() {
    while (Serial.available()) 
    Serial.read();
}

uint8_t readline(char *buff, uint8_t maxbuff, uint16_t timeout) {
  uint16_t buffidx = 0;
  boolean timeoutvalid = true;
  if (timeout == 0) timeoutvalid = false;
  
  while (true) {
    if (buffidx > maxbuff) {
      break;
    }

    while(Serial.available()) {
      char c =  Serial.read();

      if (c == '\r') continue;
      if (c == 0xA) {
        if (buffidx == 0)   // the first 0x0A is ignored
          continue;
        
        timeout = 0;         // the second 0x0A is the end of the line
        timeoutvalid = true;
        break;
      }
      buff[buffidx] = c;
      buffidx++;
    }
    
    if (timeoutvalid && timeout == 0) {
      break;
    }
    delay(1);
  }
  buff[buffidx] = 0;  // null term
  return buffidx;
}

What the serial monitor shows

FONA basic test
Initializing....(May take 3 seconds)
Attempting to open comm with ATs
	---> AT
	<--- 
	---> AT
	<--- 
	---> AT
	<--- 
	---> AT
	<--- 
	---> AT
	<--- AT
	---> AT
	<--- AT
	---> ATE0
	<--- ATE0
	---> ATE0
	<--- OK
	---> AT+CVHU=0
	<--- OK
	---> ATI
	<--- SIM800 R14.18

OK

	---> AT+CPMS="SM","SM","SM"
	<--- +CPMS: 0,40,0,40,0,40
FONA is OK
Send to #(I have to redact this information, but this is a phone number)
Type out one-line message (140 char): This is a test message
	---> AT+CMGF=1
	<--- OK
	---> AT+CMGS="(I have to redact this information,but this is a phone number)"
	<--- > 
> This is a test message
^Z
Failed

As you may see, it all works except for the last part, it says “Failed” and I have no clue why, I have followed the instructions as such on https://www.teachmemicro.com/arduino-gsm800l-tutorial/ but still to no avail. Help would be greatly appreciated. Thank you and have a nice day :slight_smile:

Quick edit: Have tried multiple times, same input, same output(failed)
Quick edit #2:I also have no clue where “^Z” comes from in the 2nd to the last line of the serial monitor

I have the same issue... Any ideas on what it is

Hello Captain and john.

At first i suggest that check the power supply , because the module need 2A for sending or receiving or connect to the network. for this issue you must use lm2596 module , and at the output of it connect a 1000uF capacitor , and your wiring must be very very short .

for program code , do according to link below .
In-Depth: Send Receive SMS & Call with SIM800L GSM Module & Arduino.

it is very useful link.

any question ???

TOMCAT.