ID: sap-cf-mailer-example
_schema-version: "2.1"
description: Example sap cf mailer
version: 0.0.1
modules:
- name: approuter
type: approuter.nodejs
path: approuter
parameters:
disk-quota: 256M
memory: 256M
requires:
- name: uaa
- name: destination_service
- name: mail_api
group: destinations
properties:
forwardAuthToken: true
name: mail_api
strictSSL: false
url: '~{url}'
- name: srv
type: nodejs
path: srv
parameters:
memory: 512M
disk-quota: 256M
provides:
- name: mail_api
properties:
url: ${default-url}
requires:
- name: uaa
- name: destination_service
resources:
- name: destination_service
type: org.cloudfoundry.existing-service
- name: uaa
type: org.cloudfoundry.existing-service
$ npm install -s sap-cf-mailer
const express = require('express');
const app = express();
const SapCfMailer = require('sap-cf-mailer').default;
const transporter = new SapCfMailer("MAILTRAP");
app.use(express.json());
app.get('/sendmail', async (req, res) => {
// use sendmail as you should use it in nodemailer
const result = await transporter.sendMail({
to: 'someoneimportant@sap.com',
subject: `This is the mail subject`,
text: `body of the email`
});
res.send(result);
});
const port = process.env.PORT || 3000;;
app.listen(port, function () {
console.log('myapp listening on port ' + port);
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
5 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |