LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-21-2017, 09:36 AM   #1
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Rep: Reputation: Disabled
Send text via Linux


Is it possible to send a text to a mobile device from Linux command line?
This is what I used but I'm not getting the text:
Code:
echo "enter message body here" | mailx -s "email subject" recipient@email.com mobilenumber@vtext.com
I've tried to a Verizon phone and a Sprint phone. Neither got the text.
 
Old 06-21-2017, 09:41 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
you can send an email only to an email address, not a device.
But I think in your case there is no mail server to handle your request.
 
Old 06-21-2017, 10:00 AM   #3
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
I figured since Powershell can do it Linux can too
 
Old 06-21-2017, 10:06 AM   #4
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 6/7
Posts: 1,375

Rep: Reputation: 217Reputation: 217Reputation: 217
Saying can Linux send a message to a phone isn't really giving much of what you want to do. Are you looking to send an SMS? Are you looking to send an e-mail (in which case a mobile phone is no different) or perhaps use some form of IM? Asking can Linux connect to a phone (which itself maybe running linux!) is too much of a generic question.
 
Old 06-21-2017, 10:07 AM   #5
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
it should work. you'd have to know how to format the email address so that the telefone company forwards it to the correct mobile number (all the major telco's have different domain names).

not sure how outdated this mite be:
http://www.wikihow.com/Send-a-Text-from-Email

Last edited by schneidz; 06-21-2017 at 10:11 AM.
 
Old 06-21-2017, 10:22 AM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i wonder if your server is configured for smtp/sendmail or whatever.
i know with comcast they blacklist users not paying for their business speed from spamming emails (regardless of powershell vs. bash).
 
Old 06-21-2017, 10:27 AM   #7
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
I can do this successfully in Powershell(yuck). I used the appropriate domain names too. I am trying to send a SMS, but I call it text. Sorry for the confusion
 
Old 06-21-2017, 10:32 AM   #8
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
your not really troubleshooting this well which is causing us to go on wild goose chases.

what email service are you using to send out emails in powershell / what email service are you using to send out emails in linux command-line ?

are you able to receive email from regular email addresses (e.g.- @yahoo, @aol, @gmail, ...) from the linux command-line ?
 
Old 06-21-2017, 10:36 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,691

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
Yes, you can send a SMS text message to a phone via email. As stated if your system is not configured for outgoing mail the posted command will not work.

The quickest way might be to use a command line email client that connects to your email server using your email credentials. Most email providers provide the authentication methods, ports etc to manually configure a client and they can be saved to a configuration file if desired. mutt and alpine are the most common command CLI clients.
 
Old 06-21-2017, 01:02 PM   #10
trickydba
Member
 
Registered: Nov 2016
Location: Atlanta,Georgia
Posts: 310

Original Poster
Rep: Reputation: Disabled
@schneidz.......PowerShell(yuck) uses Send-MailMessage cmdlet, Linux I tried using MailX. Yes I am able to send emails using regular email addresses.

@michaelk.......My system is configured for outgoing mail
 
Old 06-21-2017, 01:10 PM   #11
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
So you do not have Outlook on the machine but are able to send email?
As stated above, you need a command-line email client and the correct configuration files to send email.
I would be surprised if the Windows machine does not have Outlook configured.
 
Old 06-21-2017, 01:39 PM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,691

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
As far as I know it should work and the basic syntax for Verizon is:

Code:
echo "Hello World" | mailx -s "message Subject" 10_digit_phone_number@vtext.com
 
Old 06-21-2017, 05:09 PM   #13
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by michaelk View Post
As far as I know it should work and the basic syntax for Verizon is:

Code:
echo "Hello World" | mailx -s "message Subject" 10_digit_phone_number@vtext.com
Just tested that syntax and it worked for me...received a SMS message on my Verizon phone.

Tried with two email addresses, as the OP showed, and both the actual email address and the phone received the message.
Question to the OP, does the "recipient@email.com" get the email?
 
Old 06-21-2017, 07:55 PM   #14
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Is the message sent by cellular modem? How does it get into the cell network?
 
Old 06-21-2017, 08:40 PM   #15
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by AwesomeMachine View Post
Is the message sent by cellular modem? How does it get into the cell network?
The syntax as posted by michaelk in #12 will send a (SMS) message to the 10-digit cell number on Verizon Wireless.

Repeating:
Question to the OP, does the "recipient@email.com" get the email?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Sockets with linux, how to send same text string to all connected clients c/c++ Mogget Programming 9 05-18-2010 04:48 AM
in Pascal: how to exec a program, discard text output or send to text file Valkyrie_of_valhalla Programming 6 05-02-2007 09:50 AM
How do I use Linux POST command to send text to remote server Bill K Linux - General 1 05-19-2006 09:26 PM
Send text message from windows to linux ok goutham_v Linux - General 3 04-18-2004 01:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration