Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- emailInvoice () {
- Axios({
- method: 'post',
- url: 'http://myApi/api/html-to-pdf',
- data: {
- html: this.getInvoiceHtml()
- },
- responseType: 'blob'
- }).then(function (pdfResponse) {
- Axios.post('http://localhost:4000/api/send-email', {
- host: '##',
- port: '26',
- user: '##',
- pass: '##',
- to: '##',
- from: '##',
- subject: 'Invoice ' + this.model.doc.ref,
- text: 'Test Text',
- html: '<b>TEST</b>',
- attachments: [{
- filename: this.model.doc.ref + '.pdf',
- content: pdfResponse.data,
- contentType: 'application/pdf'
- }]
- }).then(function (response) {
- console.log('Email Success')
- console.log(response)
- }).catch(function (error) {
- console.log('Email Error')
- console.log(error)
- })
- }.bind(this)).catch(function (error) {
- console.log('PDF Error')
- console.log(error)
- })
- }
Add Comment
Please, Sign In to add comment