# SMS

### Sending to an email to sms gateway

Lets assume the gateway you are sending to accepts sms messages of the form NUMBER@sms.com, then add the following settings to surgemail.ini

    	g_redirect was="smsgate_*@*" to="%1@sms.com"
      g_sms_gateway "127.0.0.1:2025" # this setting isn't used  but is required to enable the sms pages.
      vdomain name="x.y.z"
    		...
    		user_sms "true"
      vdomain name="a.b.c"
    		...
    		user_sms "true"

NOTE: The rest of this page referes to the 'smsgate' module which we no longer supply, it is recommended you use the above method instead for better/simpler results and lower cost.

The following documentation is only here for administrators already using smsgate.

### Simple notification of email via SMS

By setting the g_sms_gateway setting to the ip:port of the machine where SMSGate is installed, then setting user_sms to TRUE for each domain you allow your users to configure SMS notificaition of email based on rules of their choice. This means when an email arrives for this user that matches a rule they have specified the first ~160 characters of the email are sent to the cell phone number they provide. Example surgemail.ini settings:

    global_settings
    	g_sms_gateway "127.0.0.1:2025"

    vdomain name="domain.com" address=""
    	user_sms "TRUE"

The user can reply to the SMS notification specifying an email address in the reply their SMSwill be delivered to the email specified.

### Advanced SMS gatewaying

By configuring a g_gateway setting and a g_redirect rule, you can allow you users to send SMSto anyone simply by sending an email to a specified email account on your server. Example surgemail.ini settings:

    global_settings
    	g_gateway domain="smsgate.domain.com" to="127.0.0.1:2025" user="" pass="" relay="FALSE" check="" sms="TRUE"
    	g_redirect was="smsgate_*@*" to="%1@smsgate.domain.com"

Using the above configuration settings users can send email to smsgate_<number>@domain.com and an sms containing the first ~160 characters of the email will be sent to <number>.

The relay="FALSE" parameter enforces the use of SMTP authentication, this ensures only authenticated users can use this feature.

The sms="TRUE" parameter instructs SurgeMail to send the users SMS number (if provided) to SMSGate which will then use that as the sending phone number meaning replies to the SMS will go to the users phone. (A user option will be added to enable/disable this feature per user in the near future).

Some SMSGate config settings are required for the above to work, they are:

    smtp_prefix smsgate_
    accept_from *@domain.com
    accept_ip 127.0.0.1

The above smtp_prefix setting matches the prefix shown in the g_redirect rule as the was="" parameter. The accept_from setting is a wildcard comma seperated list of valid email address to allow SMS sends for. The accept_ip setting specifies the ip address of the SurgeMail server.

### Various SMS delivery options

SMSGate has support for several different SMS delivery options including using a GSM modem, delivery via an online provider using HTTP or SMTP based requests and even untested SMPP support. For more information see here.