【发布时间】:2022-07-06 18:30:44
【问题描述】:
我尝试使用 EmailJS 在我的颤振应用程序中创建一个自动电子邮件服务,并按照文档中提到的那样进行操作,但是在我们必须指定 user_id 的部分中,它被写入文档中,它是我帐户的公钥。但是,使用我帐户的公钥作为 user_id,会出现以下错误:
The Public Key is required. To find this ID, visit https://dashboard.emailjs.com/account
我使用该服务的代码是:
Future<void> sendEmailToParents() async{
print('send email to parents :))');
final serviceId='service_fm3ymlj';
final templateId='template_ru9gpkp';
final userId='SaGQJusVSIxIMGhiw';
print(userId);
final url = Uri.parse('https://api.emailjs.com/api/v1.0/email/send');
final response=await http.post(
url,
headers:{
'ContentType': 'application/json',
},
body: json.encode({
'service_id': serviceId,
'template_id': templateId,
'key': userId,
'template_params': {
'lost_child_name': _name,
'user_name':_username,
'user_contact_number':_user_contact_number,
'user_email':widget.email,
'location':_location,
'police_address':_registered_lost_at,
"parent's_email":_parent_email,
// "child_img_url": image1
},
})
);
print(response.body);
}
有人可以指导我哪里出错了吗?我使用了这里的公钥
【问题讨论】: