File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 11import 'package:flutter/material.dart' ;
2- import 'package:emailjs/emailjs.dart' ;
2+ import 'package:emailjs/emailjs.dart' as emailjs ;
33
44void main () {
55 runApp (const App ());
@@ -31,22 +31,26 @@ class HomePage extends StatefulWidget {
3131class _HomePageState extends State <HomePage > {
3232 void _sendEmail () async {
3333 try {
34- await EmailJS .send (
35- '< YOUR_SERVICE_ID> ' ,
36- '< YOUR_TEMPLATE_ID> ' ,
34+ await emailjs .send (
35+ 'YOUR_SERVICE_ID' ,
36+ 'YOUR_TEMPLATE_ID' ,
3737 {
38- 'user_email ' : 'hi@example.com' ,
38+ 'to_email ' : 'hi@example.com' ,
3939 'message' : 'Hi' ,
4040 },
41- const Options (
42- publicKey: '<YOUR_PUBLIC_KEY>' ,
43- privateKey: '<YOUR_PRIVATE_KEY>' ,
41+ const emailjs.Options (
42+ publicKey: 'YOUR_PUBLIC_KEY' ,
43+ privateKey: 'YOUR_PRIVATE_KEY' ,
44+ limitRate: const emailjs.LimitRate (
45+ id: 'app' ,
46+ throttle: 10000 ,
47+ )
4448 ),
4549 );
4650 print ('SUCCESS!' );
4751 } catch (error) {
48- if (error is EmailJSResponseStatus ) {
49- print ('ERROR... ${ error . status }: ${ error . text } ' );
52+ if (error is emailjs. EmailJSResponseStatus ) {
53+ print ('ERROR... $error ' );
5054 }
5155 print (error.toString ());
5256 }
You can’t perform that action at this time.
0 commit comments