I am trying to use Google App Script to send an email to my google voice which then sends a text to my phone. Everything works flawlessly, except that I cannot get line breaks to work. (also, to be clear, even direct from my gmail fails to produce line breaks)
NOTE: I know there are other ways to send text messages programmatically, but one of the requirements is that they get to my phone in the same chat. If I use my carrier’s email to text abilities, it comes from a different contact each time.
##Quick Breakdown of What I Have Tried:##
n
r
rn
n
are all completely ignorednn
ends the message at this point, ignoring all subsequent
text%0a
and%0A
just present as text<br>
present as text
if I encode as {htmlBody: message}:
<br>
are ignored<br><br>
ends the message at this point, ignoring all subsequent
text
I have also tried all of the above with temperate literals and simply line breaking my code inside temperate literals
##Code Examples##
Here is how the chat bots and other questions on stackoverflow say it should work:
function sendSMS() {
var phoneNumber = '[email protected]';
var subject = '';
var message = 'Hello,nThis is a test message with line breaks.nPlease confirm if it works.nnThank you.';
GmailApp.sendEmail(phoneNumber, subject, message);
}
With htmlBody
function sendSMS() {
var phoneNumber = '[email protected]';
var subject = '';
var message = 'Hello,<br>This is a test message with line breaks.<br>Please confirm if it works.<br><br>Thank you.';
GmailApp.sendEmail(phoneNumber, subject, '', {
htmlBody: message
});
}
Questions
-
Is there a way to do what I am trying to do in the way that I am trying to do this?
-
Is there a different way / third party API that can achieve the results I am looking for while maintaining a single ‘from’ contact in my text messages?