Last active
          August 3, 2021 17:34 
        
      - 
      
- 
        Save ondrej-kvasnovsky/6113201 to your computer and use it in GitHub Desktop. 
    How to send email from Meteor JS framework.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Template.welcomePage.events({ | |
| 'click #send-email-button': function () { | |
| var email = { | |
| to: '[email protected]', | |
| from: '[email protected]', | |
| replyTo: '[email protected]', | |
| subject: "test email", | |
| text: "hello lover boy" | |
| }; | |
| Meteor.call('sendEmail', this.userId, email); | |
| } | |
| }); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Meteor.methods({ | |
| sendEmail: function (userId, email) { | |
| if (this.userId == userId) { | |
| Email.send(email); | |
| } | |
| } | |
| }); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <template name='welcomePage'> | |
| <a id='send-email-button'>Send email</a> | |
| </template> | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment