Hi,
I am new in meteor. I want send email but it is giving error. I have added the email package.
i have created account on the mailgun for the email services
I have button on main.html
<button id="email1"> Test Email </button>
this is js code
’’'if(Meteor.isClient){
Template.HomeTemplate.events({
'click #email1': function (e) {
e.preventDefault();
Meteor.call('sendEmail')
}
});
if(Meteor.isServer){
Meteor.methods({
‘sendEmail’:function(email,subj,body){
this.unblock();
alert(‘in the email function’)
Email.send({
to:'test@gmail.com',
from:'no-reply@Meteordomail.com',
subject:Test,
text:'this is new mail'
})
}
})
}```
It is not not enter in the if(meteor.isServer). and showing the error
"Error invoking Method ‘sendEmail’: Method ‘sendEmail’ not found [404]"
if I comment the meteor.isServer Condition then error shows
"Email is not defined"
and “Error invoking Method ‘sendEmail’: Method ‘sendEmail’ not found [404]”.
I moved the code in the Server folder but then it is showing
Error invoking Method ‘sendEmail’: Internal server error [500]
I have set process.env.MAIL_URL = “smtp://postmaster%40sandboxxxxxxxx.mailgun.org:xxxxxxxx@smtp.mailgun.org:587/”;