sms

package module
v0.0.0-...-ddafd5c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

sms

What is sms?

A simple Golang sms library. Use email to send a sms. inspired from sms-fu.

Install

go get github.com/acmacalister/sms

Usage

sms is really simple. Check out the example below or have a look at the test. Note for the test to run you need to update the sms.yml with your own email account's username/password and a phone number to successfully send a sms.

package main

import (
  "github.com/acmacalister/sms"
  "log"
)

func main() {
  client, err := createClient("smtp.gmail.com", 587, "tester@gmail.com", "test")
  if err != nil {
    log.Fatal(err)
  }
  if err := client.Deliver("5555555555", "AT&T", "sms golang library!"); err != nil {
    log.Fatal(err)
  }
}
License

sms is licensed under the Apache License.

Authors
ToDo
  • Test other carriers. (Currently only AT&T has been tested.)
  • Bring test coverage from 75% to 100%.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	OutboundServer string
	Port           int
	EmailAddress   string
	Password       string
	// contains filtered or unexported fields
}

func New

func New(outboundServer, email, password string, port int) (*Client, error)

func (*Client) Deliver

func (client *Client) Deliver(number, carrier, message string) error

type Config

type Config struct {
	FromAddress string            `toml:"from_address"`
	Carriers    map[string]string `toml:"carriers"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL