SquidSMS is a Python-based SMS sending tool that allows you to send SMS messages using a Gmail account. It provides a convenient way to send quick reminders and information to yourself or other consenting parties. The tool is designed to be easy to use and provides functionality for connecting to the SMTP server, sending messages, validating phone numbers, and validating carriers.
- Please use this tool responsibly and in accordance with applicable laws and regulations. Do not use it for illegal activities. Refer to https://www.fcc.gov/tags/telephone-consumer-protection-act-tcpa for more information.
- Standard Message and Data Rates may apply
Before using SquidSMS, make sure you have the necessary dependencies:
- SMTP Library
smtplib
for establishing an SMTP connection.-
pip install smtplib
- Some possible Error Codes
-
- Logging
logging
for debug messages throughout the send process (replaces print statements of previous versions)-
pip install logging
-
- Gmail App Password
- Required for access to the Gmail Account, I would reccomend creating a burner account so anything important is not compromised if something goes wrong or the password is somehow leaked.
- You will need to setup 2-Factor Verification to access App Passwords through Google
Method | Description | Parameters | Returns |
---|---|---|---|
__init__ |
Initializes the SquidSMS class, sets up the CARRIERS dictionary, and assigns the authentication values |
email (string), password (string) |
None |
connect() |
Connects to the SMTP server using Gmail account credentials. | None | Server object or tuple with disconnect code |
send() |
Sends an SMS message. Checks phone number and carrier validity. | server (smtp server object), phone_number (string), carrier (string), message (string) |
Boolean (success status) |
check_phone_number() |
Checks if the provided phone number is correctly formatted (10-digit format). | phone_number (string) |
Boolean (validity) |
check_carrier() |
Checks if the provided carrier is valid and supported. | carrier (string) |
Boolean (validity) |
disconnect() |
Handles the disconnection from the SMTP server. | server (object) |
None |
- CARRIERS (dictionary):
- Defines cellular service providers and their email-to-SMS conversion addresses.
- AUTH_EMAIL (string): Your Gmail email address.
- AUTH_PASS (string): An App Password provided by Google Authentication. It should be a 16-character string.
- This will work with any number which follows the 10-digit format and is covered by one of the available carriers
- To change the number format, edit the code in
check_number
to an number which applies to your situation.
- To change the number format, edit the code in
- DO NOT include country codes in the phone numbers, through my testing with numbers from the USA, +1 country code, this will break the send process.
- When sending to a number, the number MUST be covered by the selected carrier. If there is a mismatch between carrier and number the message will send but wont be delivered.
- You can add new carriers to the program by modifying the
CARRIERS
dictionary with the new carrier name and email domain.
- EMAIL: This should be your GMAIL account that you want to use in sending the messages
- PASSWORD: The App password provided by Google Authentication, should be a 16-character string
main.py:
from SquidSMS import SquidSMS
your_gmail = '[email protected]'
your_app_password = 'oiu12dmi12p9knao'
# Initialize the class
example = SquidSMS(your_gmail, your_app_password)
# Connect to SMTP server and store it
server = example.connect()
# Parameters should all be strings
recipient_number = '8881237890'
recipient_carrier = 'Verizon'
my_message = 'Wow this is pretty cool!'
# If the send is successful, call function to disconnect from server
result = example.send(server, recipient_number, recipient_carrier, my_message)
if result:
example.disconnect(server)
print('send successful?', result)
Console Output:
send successful? True
check phone in a few seconds and the message should be there
- The recipient's number will be prepended to the email domain address of the chosen carrier like this:
number = '5551234567', carrier = '@mms.att.net', recipient = '[email protected]'
- From there the SMTP server provided by Google is connected to, using your email and password, and the message is sent to the new recipient email address
- The message is then transmitted from that new email address to the device associated with the number.
- Cannot check if message was received,
- Cannot check if phone number is real,
- Cannot receive messages from recipient phone number
- Message sends limited by gmail
- Sending with .format() leads to unintended message contents:
client_name = 'Bob' message = 'Hi {}, you\'re awesome!'.format(client_name) # Intended message: Hi Bob, you're awesome! # Actual message: Hi Bob, you're awesome! # X-CMAE-Envelope: # MWi19ow8hdinjasdiuioais # mOIaundaoiudnaoinsdao1/ # W<M)D_!JI_!_JIDNU#I#KAJ
- Sends can occasionally take several hours due to SMTP service issues
Copyright: © 2024 Sean Coleman