Last updated:
0 purchases
mailjet
MailJet #
Unofficial Mailjet client.
Meant to provide easy access(interaction) to core mailjet functionality.
Hecho en 🇵🇷 por Radamés J. Valentín Reyes
Import package #
import 'package:mailjet/mailjet.dart';
import 'dart:io';
copied to clipboard
Get API key #
Step 1 #
Step 2 #
Step 3 #
Step 4 #
Copy the credentials from the last page(step 3)
Get SMS API token #
Step 1 #
Step 2 #
Step 3 #
Step 4 #
Copy the Token value from step 3
Send Email #
How to send a simple HTML email? #
An example sending and email to oneself
String apiKey = "public key provided by mailjet";
String secretKey = "secret key provided by mailjet";
//An email registered to your mailjet account
String myEmail = "[email protected]";
MailJet mailJet = MailJet(
apiKey: apiKey,
secretKey: secretKey,
);
//Display the response after trying to send the email
print(await mailJet.sendEmail(
subject: "My first Mailjet email",
sender: Sender(
email: myEmail,
name: "My name",
),
reciepients: [
Recipient(
email: myEmail,
name: "My other name",
),
],
htmlEmail: "<h3>Dear passenger 1, welcome to <a href='https://www.mailjet.com/'>Mailjet</a>!</h3><br />May the delivery force be with you!",
));
copied to clipboard
HTML email with attachments #
MailJet mailJet = MailJet(
apiKey: apiKey,
secretKey: secretKey,
);
await mailJet.sendEmail(
subject: "My first Mailjet email",
sender: Sender(
email: myEmail,
name: "My name",
),
reciepients: [
Recipient(
email: myEmail,
name: "My other name",
),
],
htmlEmail: "<h3>Dear passenger 1, welcome to <a href='https://www.mailjet.com/'>Mailjet</a>!</h3><br />May the delivery force be with you!",
Attachments: [
File("./images/raw_ware.png"),
],
)
copied to clipboard
HTML email with inline attachments #
MailJet mailJet = MailJet(
apiKey: apiKey,
secretKey: secretKey,
);
print(await mailJet.sendEmail(
subject: "My first Mailjet email",
sender: Sender(
email: myEmail,
name: "My name",
),
reciepients: [
Recipient(
email: myEmail,
name: "My other name",
),
],
htmlEmail: "<img src='cid:raw_ware_logo'><br/><h3>Dear passenger 1, welcome to <a href='https://www.mailjet.com/'>Mailjet</a>!</h3><br />May the delivery force be with you!",
InlinedAttachments: [
InlinedAttachment(
file: attachedImage,
contentID: "raw_ware_logo",
),
],
));
copied to clipboard
Send SMS(untested function(may not work)) #
Sending text messages
MailJet mailJet = MailJet(
apiKey: apiKey,
secretKey: secretKey,
);
print(await mailJet.sendSMS(
smsSecretKey: smsSecretKey,
from: "Secret",
to: "+19394644793",
text: "Testing Mailjet SMS services. Package created by Raw Ware Software.",
));
copied to clipboard
Contribute/donate by tapping on the Pay Pal logo/image #
Created by #
References #
https://serverfault.com/questions/371907/can-you-pass-user-pass-for-http-basic-authentication-in-url-parameters
https://documenter.getpostman.com/view/6592892/S1a4WS95#auth-info-2abd657f-0a3b-4965-8ed5-2bc9d1333489
https://documenter.getpostman.com/view/6592892/S1a4WS95#auth-info-f5f4e52d-b7f7-45cd-b7d0-eba473bcf68b
https://app.mailjet.com/auth/get_started/developer
https://stackoverflow.com/questions/50036393/how-to-convert-an-image-to-base64-image-in-flutter
https://stackoverflow.com/questions/30351465/html-email-with-inline-attachments-and-non-inline-attachments
https://learning.postman.com/docs/sending-requests/authorization/#:~:text=URL%20query%20string.-,Bearer%20token,enter%20your%20API%20key%20value.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.