Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

How do I send emails using Pony and Sinatra?

$
0
0

@Dahnaya_Joyner wrote:

I am trying to make an ajax request in Ember that sends a user and email after they submit their email address. I am using Pony to send emails and Sinatra in the back end. The ajax request data is blank because I’m not sure how to go about it or if this is the correct way to go. This is what I have:

POST email

post '/v1/email' do
Pony.mail :to => "dahjoyner12@gmail.com",
:from => "noreply@soi.com",
:subject => "Welcome",
:body => "hello",
:via => :smtp,
:via_options => {
    :address  => 'smtp.gmail.com',
    :port     =>  '9393'
    }
end

forgot-password-form.js

import Component from '@ember/component';

export default Component.extend({

buttonLabel: 'Save',

actions: {
buttonClicked(item) {
console.log('email form');
this.sendAction('verify', item);
}
}
});

forgot-password.js

import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default Route.extend({
model() {
return this.get('store').findAll('user');
},

ajax: service(),

actions: {
verify() {
  return this.get('ajax').post('/email', {
    data: {

    }
  });
}
}
});

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles