Command/Script

Send email from everywhere

Register Here

You can send email using a command line or a script


CURL

curl is an open source command line tool and library for transferring data with URL syntax

Request

curl -H "Content-Type: application/json" -v -X POST -d '{"name":"josdem","email":"joseluis.delacruz@gmail.com","message":"Hello from curl!", "template":"message.ftl","token":"userToken"}' 'https://jmailer.josdem.io/emailer/message'


OkHttp

HTTP is the way modern applications network. It’s how we exchange data & media. Doing HTTP efficiently makes your stuff load faster and saves bandwidth.


@Throws(IOException::class)

fun post(url: String, json: String): String {

  val body: RequestBody = RequestBody.create("application/json".toMediaType(), json)

  val request: Request = url.let {

    Request.Builder()

    .url(url)

    .post(body)

    .build()

  }



  client.newCall(request).execute().use { response ->

    return response.body!!.string()

  }

}

To see the complete HTTP client code go here

Note: it should be a valid token to send the request successfully.