I have the running app which sends verification emails in case of email/account name creation but it does not send verification email if I login with google/facebook; it is probably due to email address which is in services.google.email; how can I set field 'to' in Accounts.emailTemplates if it does exist.
configureAccounts = function() {
setMailVerification(enableMailVerification);
};
setMailVerification = function() {
Accounts.emailTemplates.from = 'myEmail@.com';
Accounts.emailTemplates.verifyEmail = {
subject : function(user) {
return "Confirmation"
},
text : function(user, url) {
var greeting = (user.profile && user.profile.nick) ? ("Hello " + user.profile.nick + ",") : "Hello,";
return greeting +
"\n\n" + "Thank you for registration."+
"\n" + "To confirm click the following link:" + url +
"\n\n" + "thank you."
}
};
Accounts.config({
sendVerificationEmail : true,
forbidClientAccountCreation : false
});
};
please let me know if you where I should put ...services.google.email in case of google login and the same for facebook...
in other words how I can sent verification email to Meteor.user().services.google.email .. (even recalling sendUserVerificationEmail with that email does not work as it is not in 'emails')
I modified .email property onCreateUser as follows:
if(user.services != undefined) {
console.log('services in onCreateUser');
user.sentVerificationEmail = false;
user.emails =[];
var emailServices = user.services.google != undefined ?
user.services.google.email :
user.services.facebook.email;
user.emails.push({
address : emailServices,
verified : false
});
}
if (options.profile)
user.profile = options.profile;
return user;
I called then Accounts.sentVerificationEmail then onLogin .. and it worked;
thank you all for having a look