Ich muss ein Outlook-Kalenderereignis festlegen, für das ich den Poststempel SMTP-Dienst verwende Ich habe iCalToolkit verwendet, um ein Kalenderobjekt zu erstellen.Keine Transportmethode definiert: Kalenderereignis
aber hier bekomme ich einen Fehler [Keine Transportmethode definiert] Einige Tage bevor es richtig funktionierte, aber es begann heute Fehler zu zeigen. ich verwende express Rahmen Ich verstehe nicht, die Frage
var _ = require('lodash');
var Outlook = require('./outlook.model');
exports.sendMsg = function(req, res) {
console.log("this is outlook ctrl" + req.query.dateOfInterview);
var icalToolkit = require('ical-toolkit');
var postmark = require("postmark");
// Example request
var client = new postmark.Client("key");
//var postmark = require('postmark');
//var client = new postmark.Client('xxxxxxxKeyxxxxxxxxxxxx');
var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');
console.log(req.query);
//Create a iCal object
var builder = icalToolkit.createIcsFileBuilder();
builder.method = 'REQUEST';
//Name of calander 'X-WR-CALNAME' tag.
builder.calname = 'Yo Cal';
builder.events.push({
//Event start time, Required: type Date()
start: new Date(),
//Event end time, Required: type Date()
end: new Date(req.query.dateOfInterview),
//Event summary, Required: type String
summary: 'Scheduled interview For ' + req.query.name,
//All Optionals Below
//Alarms, array in minutes
alarms: [120, 60]
});
//builder.method = meeting.method;
//Add the event data
var icsFileContent = builder.toString();
var smtpOptions = {
"host": "smtp.postmarkapp.com",
"port": 25,
"secureConnection": true,
"auth": {
user: 'username',
pass: 'password'
}
};
var transporter = nodemailer.createTransport(smtpTransport(smtpOptions));
console.log(transporter);
var mailOptions = {
from: '******',
to: req.query.tpMail,
alternatives: [{
contentType: 'text/calendar; charset="utf-8"; method=REQUEST',
content: icsFileContent.toString()
}]
};
//send mail with defined transport object
transporter.sendMail(mailOptions, function(error, info) {
if (error) {
console.log(error);
} else {
console.log('Message sent: ' + info.response);
}
res.end();
});
};
Jede Hilfe würde geschätzt.