Meteor.startup(function () {
// 1. Set up stmp
var username = 'xxx';
var password = 'xxx';
var server = 'smtp.mailgun.org';
var port = '25';
process.env.MAIL_URL = 'smtp://' +
encodeURIComponent(username) + ':' +
encodeURIComponent(password) + '@' +
encodeURIComponent(server) + ':' + port;
// 2. Format the email
//-- Set the from address
Accounts.emailTemplates.from = 'test@test.com';
//-- Application name
Accounts.emailTemplates.siteName = 'My_App';
//-- Subject line of the email.
Accounts.emailTemplates.verifyEmail.subject = function(user) {
return 'Confirm Your Email Address for My_App';
};
//-- Email text
Accounts.emailTemplates.verifyEmail.text = function(user, url) {
var newUrl = url.replace('/#','');
return 'Thank you for registering. Please click on the following link to verify your email address: \r\n' + newUrl;
};
//3.
Accounts.config({
sendVerificationEmail: true
});
});
And now whenever someone registers he/she gets a mail?
Apparently nothing like this happens and there is no error log on server or client
So what am i missing here?
The mailgun configuration works -> i can sent emails via contactform.
Hay michael,
this doesn’t really defer from my solution except for using mandrill instead of mailgun and using a serverside templating instead of plain text? I’m not sure, but i can’t believe but this is the reason
Especially because sending emails with this config works general (even when using the “resent verification link” is anabled, pressing it sends a mail )
got it working with this on the server
Accounts.onCreateUser(function(options, user) {
user.profile = {};
// we wait for Meteor to create the user before sending an email
Meteor.setTimeout(function() {
Accounts.sendVerificationEmail(user._id);
}, 2 * 1000);
return user;
});
But now i’m once more totally confused?!
I thought:
Accounts.config({
sendVerificationEmail: true
});
would do that job? I use the accounts package inside a package - did i miss some export stuff?
Regards,
Lukas