Skip to content

Commit

Permalink
fix(contact): correct ip address header
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed Jan 25, 2024
1 parent 3a47768 commit 787c302
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server/api/contact.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const sendMail = async (event: H3Event) => {

const NODEMAILER_TRANSPORTER = createTransport(transport)

console.log(JSON.stringify(event.node.req.headers))

const body = await readBody(event)
const mailSentData = await NODEMAILER_TRANSPORTER.sendMail({
from: MAIL_FROM,
Expand All @@ -38,7 +40,7 @@ const sendMail = async (event: H3Event) => {
`Email address: ${body.emailAddress}`,
`Name: ${body.name}`,
`Message: ${body.message}`,
`IP: ${event.node.req.headers['x-real-ip']}`,
`IP: ${event.node.req.headers['cf-connecting-ip']}`,
`Timestamp: ${new Date().toISOString()}`,
].join('\n'),
subject: 'Nachricht per Kontaktformular',
Expand Down

0 comments on commit 787c302

Please sign in to comment.