Please provide the following:
- SDK Version: 2.11.2
- Platforms(ios/android/both): both
Hi All, I hope this is the right place to raise my query–if not I’m happy to move this elsewhere.
I’m looking to periodically send reminder text messages as a background process. I tried SMS.sendSMSAsync()
, which is awesome, but this pulls up the default SMS service on the host and requires the user to submit the send button. That’s not fatal but it’d be nicer to do this in the background.
I have started exploring sending SMS programmatically from a simple server-side Python, ala:
import smtplib
import email.mime.multipart
sender = 'douglas.duhaime.messenger@gmail.com'
# Establish a secure session with gmail's outgoing SMTP server using your gmail account
server = smtplib.SMTP('smtp.gmail.com', 587)
server.set_debuglevel(1)
server.ehlo()
server.starttls()
server.login(sender, YOUR_PASSWORD_GOES_HERE)
msg = '\r\n'.join([
'MIME-Version: 1.0',
#'Date: Fri, 22 Feb 2019 11:29:27 -0500',
#'Message-ID: 12345678',
'Subject: cartes', # shows up in bold at top of message
'From: Douglas Duhaime <douglas.duhaime.messenger@gmail.com>',
'To: MY_PHONE_NUMBER@tmomail.net',
'Content-Type: multipart/alternative; boundary="0000000000003c664305827e1862"',
'',
'--0000000000003c664305827e1862',
'Content-Type: text/plain; charset="UTF-8"',
'',
'message from dd',
'',
'--0000000000003c664305827e1862',
])
# sendmail(from, to, msg)
server.sendmail('douglas.duhaime.messenger@gmail.com', 'MY_PHONE_NUMBER@tmomail.net', msg)
That indeed sends me a text message, but requires me to know the service provider of the recipient, and shows the sender as douglas.duhaime.messenger@gmail.com, while I’d like the user’s phone to show up as the sender.
Is there a straightforward way to send a message programmatically with expo or related server-side code? I’d be grateful for any advice others can offer on this question.