sendgriddle
Types
pub type Email {
Email(
to: List(String),
sender_email: String,
sender_name: String,
subject: String,
content: EmailContent,
)
}
Constructors
-
Email( to: List(String), sender_email: String, sender_name: String, subject: String, content: EmailContent, )Arguments
- to
-
A list of emails to whom this email will be sent.
- sender_email
-
The email address from which messages are sent, it should be a verified sender in your Twilio SendGrid account.
- sender_name
-
A name or title associated with the email address such as “Support” or “Alice”.
- subject
-
The subject of your email.
Note how, as per RFC 2822, the subject line should be no more than 78 characters, and must be no more than 998 characters.
pub type EmailContent {
TextContent(text: String)
RichContent(html: String, text: String)
}
Constructors
-
TextContent(text: String) -
RichContent(html: String, text: String)
pub type ErrorObject {
ErrorObject(
message: String,
field: option.Option(String),
help: option.Option(String),
)
}
Constructors
-
ErrorObject( message: String, field: option.Option(String), help: option.Option(String), )Arguments
- field
-
The request’s field that generated the error, if applicable.
- help
-
A helper text or a link to documentation to help you troubleshoot the error.
pub type SendGridError {
SendGridError(
id: option.Option(String),
errors: List(ErrorObject),
)
UnexpectedResponseError(response: response.Response(String))
}
Constructors
-
SendGridError( id: option.Option(String), errors: List(ErrorObject), )Arguments
- id
-
An id identifying the error, if applicable.
-
UnexpectedResponseError(response: response.Response(String))
Values
pub fn mail_send_request(
email: Email,
api_key: String,
) -> request.Request(String)
A request to send email over SendGrid’s v3 Web API.
pub fn mail_send_response(
response: response.Response(String),
) -> Result(Nil, SendGridError)
Parse a response to a mail-send request, to determine whether or not it was successful.