v4.0.0
emailjs
EmailJS 帮助您直接从 Flutter 应用发送电子邮件。无需服务器。
46喜欢 1100近 30 天下载160Pub 分数
AndroidiOSWebmacOSWindowsLinux
Flutter 的官方 EmailJS SDK
{"sdk":"flutter"}^1.1.0^2.2.3{"sdk":"flutter"}^4.0.0^1.0.3以下为英文项目原文快照,最新内容请访问 GitHub。
SDK for EmailJS.com customers.
Use you EmailJS account for sending emails.
This is a flutter-only version, otherwise use
EmailJS helps to send emails directly from your code. No server is required – just connect EmailJS to one of the supported email services, create an email template, and use our SDK to trigger an email.
Install EmailJS SDK:
$ flutter pub add emailjs
Note: By default, API requests are disabled for non-browser applications. You need to activate them through Account:Security.
You need to activate API requests through Account:Security.
send email
import package:emailjs/emailjs.dart as emailjs
Map<String, dynamic> templateParams = {
'name': 'James',
'notes': 'Check this out!'
};
try {
await emailjs.send(
'YOUR_SERVICE_ID',
'YOUR_TEMPLATE_ID',
templateParams,
const emailjs.Options(
publicKey: 'YOUR_PUBLIC_KEY',
privateKey: 'YOUR_PRIVATE_KEY',
),
);
print('SUCCESS!');
} catch (error) {
print('$error');
}
init (optional)
import package:emailjs/emailjs.dart as emailjs
// set Public Key as global settings
emailjs.init(const emailjs.Options(
publicKey: 'YOUR_PUBLIC_KEY',
privateKey: 'YOUR_PRIVATE_KEY',
));
try {
// send the email without dynamic variables
await emailjs.send(
'YOUR_SERVICE_ID',
'YOUR_TEMPLATE_ID',
);
print('SUCCESS!');
} catch (error) {
print('$error');
}