Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
Sending emails on behalf of someone using nodemailer

I'm trying to send an email on behalf of my user using nodemailer but all my emails are being rejected.

My transporter works for normal use-cases where I'm sending from my own domain:

const transporter = nodemailer.createTransport({
    host: 'emailhost.com',
    port: 465,
    secure: true, 
    auth: {...},
    dkim: {
      domainName: <domainname>,
      keySelector: <keyselector>,
      privateKey: <privatekey>,
    },
  });

transporter.sendMail({
  subject: "Shop subject",
  from: `kyle@mydomain.com`,
  to: <customerEmail>,
  replyTo: <shopEmail>,
  html: "<div>my user message</div>",
})

But when I try to send on behalf of my user it doesn't work:

transporter.sendMail({
  subject: "Shop subject",
  from: `shop@exampleshop.com`,
  to: <customerEmail>,
  // sender: `kyle@mydomain.com` <-- Also tried adding this field,
  replyTo: `shop@exampleshop.com`,
  html: "<div>my user message</div>",
})

>> "Can't send mail - all recipients were rejected: 553 <shop@exampleshop.com>: Sender address rejected: not owned by user kyle@mydomain.com"

I figured if I set a DKIM DNS record and an SPF record on exampleshop.com it would mean I could send emails on behalf of the domain but still no luck.

Type: TXT Record 
Host: @ 
Value: v=spf1 include:spf.emailhost.com ~all

// Also tried adding this record in place of the one above
Type: TXT Record 
Host: @ 
Value: v=spf1 include:spf.mydomain.com ~all

Type: TXT Record 
Host: default._domainkey
Value: v=DKIM1;k=rsa;p=<DKIM DNS record from namecheap>

It's also been over an hour since I've updated the DNS records, I'm not sure what I'm doing wrong here.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!