Hello there, I have spent a great deal of time looking over the docs
I have tried two different ways to configure the email and have not yet been successful, if anyone sees what I am doing wrong and could be of some assistance that would be very much appreciated. Feeling very human and open to being humbled. đ
import express from "express";
import payload from "payload";
require("dotenv").config();
const app = express();
// import Mailgun from "mailgun.js";
// import formData from "form-data";
// require("form-data");
// require("mailgun.js");
// const mailgunKey = process.env.MAILGUN_API_KEY;
// const mailgunDomain = process.env.MAILGUN_DOMAIN;
// const mailgunForm = new Mailgun(formData);
// const mg = mailgunForm.client({
// username: "api",
// key: process.env.MAILGUN_API_KEY,
// });
require('nodemailer');
require('nodemailer-mailgun-transport');
import nodemailer from 'nodemailer';
import mg from 'nodemailer-mailgun-transport';
const mailgunKey = process.env.MAILGUN_API_KEY;
const mailgunDomain = process.env.MAILGUN_DOMAIN;
const auth = {
auth: {
api_key: mailgunKey,
domain: mailgunDomain
}
}
const transport = nodemailer.createTransport(mg(auth));
// Initialize Payload
payload.init({
secret: process.env.PAYLOAD_SECRET,
mongoURL: process.env.MONGODB_URI,
express: app,
email: {
// transportOptions: mg,
transport: transport,
//logMockCredentials: true,
fromName: process.env.FROM_NAME,
fromAddress: process.env.FROM_ADDRESS,
},
onInit: () => {
payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`);
},
});
// Add your own express routes here
// Redirect root to Admin panel
app.get("/", (_, res) => {
res.redirect("/admin");
});
app.listen(3001);
@just_board do you receive any specific error messages?
Oh I am just an idiot, left it over the weekend, came back monday and it was working
Iâm not sure what we should do with these threads. Should we delete them? Make a special tag for them?
If we mark it as âansweredâ it will end up in community help on our website. But should it?? Iâm not sure
It's tough because a lot of times people come back to a related thread and want to continue the discussion
I agree, we could make a 'non-issue' tag or similar
Yo keep threads like this, I use them all the time as adhoc examples, suuuuuuper valuble to me as a developer
@just_board yeah likely we will use a tag. I have no problem with your post, itâs just that you asked a question and then figured it out yourself but didnât provide an answer, which is fine. Iâm just not sure we should mark it as âansweredâ bc then it will end up in community help
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.