重置密码电子邮件模板

重置密码电子邮件模板

问题描述:

我已经创建了帮助程序和事件以便忘记密码,并且我已经编写了联系人电子邮件的代码,并且代码运行成功并且能够发送电子邮件,但是我想使用电子邮件模板。我做了一个验证电子邮件,使用一个电子邮件模板,使用名为的程序包“meteor add meteorhacks:ssr”重置密码电子邮件模板

这里是我写和PLZ帮我

 Template.recoverPassword.events({ 
      'submit #recovery-form':function(e,t){ 
       e.preventDefault(); 
       var email= t.find('#recovery-email').value; 
       Accounts.forgotPassword({email: email},function(error){ 
        if(error){ 
         alert("unable to send reset link"); 
        } 
        else{ 
         alert("password reset link sent"); 
        } 
       }); 

我已经写方法在服务器端发送电子邮件,如下methods.js

Meteor.methods({ 

     'sendEmail' :function(from,phone,fname,subj,body){ 
     this.unblock(); 
     Email.send({ 
      to:'[email protected]', 
      from:from, 
      subject:subj, 
      text:phone, 
      text:fname, 
      text:body, 
      html: SSR.render('contactbody', sendEmail) 
     }) 
     }, 

代码请向我建议如何为忘记密码和联系电子邮件添加电子邮件模板。我已经尝试过使用ssr包在私人文件夹下创建一个电子邮件正文,并试图插入服务器端,但它不工作,但等待寻求帮助!请告诉我如何处理。

+0

Hi @shivani,什么是联系邮件? –

+0

用户可以发送电子邮件,如果他有任何关于网站的查询..因为我已经创建了一个联系表格,就好像现在正常的电子邮件没有任何设计工作我想插入电子邮件模板。 – Shivani

要发送重置密码电子邮件

Accounts.emailTemplates.resetPassword.html = function (user, url) { 
     SSR.compileTemplate('registartionEmail', Assets.getText('email_templates/registration_confirm.html')); 
     var emailData = { 
       x: y; 
     }; 
     return SSR.render('registartionEmail', emailData); 
}; 

发送邮件联系

克林特方:您可以使用任何编辑器来从用户写邮件。您还可以使用{{用户名}},{{日期}}等一些类似的功能将邮件发送给用户表单管理员。

而在提交事件你可以调用服务器方法。

Meteor.call('sendEmail', 
      '[email protected]', 
      Meteor.user().emails[0].address, 
      'Hello from Meteor!', 
      'This is a test of Email.send.'); 

服务器端:

你可以,如果你在你的邮件正文的HTML /文本使用spacbar使用SSR。

Meteor.methods({ 
    sendEmail: function (to, from, subject, text) { 
    check([to, from, subject, text], [String]); 
    // Let other method calls from the same client start running, 
    // without waiting for the email sending to complete. 
    this.unblock(); 
    Email.send({ 
     to: to, 
     from: from, 
     subject: subject, 
     text: SSR.render("text", {username: "Pankaj"}) 
    }); 
    } 
}); 
+0

你没有得到什么?你能否让你的观点更清楚?我无法理解你的观点。 –