Reformatting Phone numbers?

I need help reformatting something like

into

This is a user input, so this has to be very precise! I’m working on it, but I can’t find anything.
I need this so I can notify people over there phone via AT&T or other’s email to text services.
An email address of a phone would be “8005551234@mms.att.net” for AT&T. Could someone help me with other service providers?

Hi,

there are probably several ways, here is one of it


set n to "1 (800) 555-1234"
set formattedNumber to do shell script "echo " & quoted form of (text ((offset of "(" in n) + 1) thru -1 of n) & " | tr -d ')'-' '"

Ok

Let’s say I have a Gmail account, how do I get emails from that without opening Mail.app?

Nevermind