Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

v3 API Kotlin Code Example


(information)

Info

We recommend using SendGrid Java, our client library, available on GitHub(link takes you to an external page), with full documentation.

(information)

Info

Do you have an API Key(link takes you to an external page) yet? If not, go get one. You're going to need it to integrate!


Using SendGrid's Java Library

using-sendgrids-java-library page anchor

_19
// using SendGrid's Java Library
_19
// https://github.com/sendgrid/sendgrid-java
_19
import com.sendgrid.*;
_19
import java.io.IOException;
_19
_19
class Example {
_19
private fun sendEmail() {
_19
_19
val sendgrid = SendGrid("SENDGRID_APIKEY")
_19
val email = SendGrid.Email()
_19
_19
email.addTo("test@sendgrid.com")
_19
email.setFrom("you@youremail.com")
_19
email.setSubject("Sending with SendGrid is Fun")
_19
email.setHtml("and easy to do anywhere, even with Kotlin")
_19
_19
val response = sendgrid.send(email)
_19
}
_19
}


Rate this page: