0

I am building a website with Express.js. It's just a demo site for now and there are no plans to host it on the live internet. I have a contact form on the site and I want to make it send e-mails to my GMail address with Nodemailer. I want Nodemailer to use a local Postfix server to send the mail.

Given that my computer has no domain name like example.com, what should I use for the Postfix system mail name in this context?

0

You would use hostname.domain where hostname is the name of the box running your mail server, and domain is your local network domain, which may be .local. However, many home networks do not have a domain, so simply using the hostname alone should work. You may also be able to use the IP address directly, if your local network does not do DNS resolution (many home routers automatically do this, or allow it to be configured).

All this assumes your accessing the information over the same network, controlled by a home router. For a more sophisticated setup, you would need to configure more things in more places.

  • A friend advised me to use my public IP address. Does this sound correct? – klasiker Jan 11 '18 at 19:31
  • That depends on your setup. If your mail server is hosted outside your local network (say, by a hosting provider), then yes, you can use its public IP. If your mail server is hosted internally, and you don't need to access it externally, then no; use your internal IP or hostname for the mail server; if it's hosted internally, but accessed externally, your public IP address points to your router, not to your mail server; you need to configure the router to forward the right ports to the mail server. – jpaugh Jan 11 '18 at 19:35
  • It will receive mail from Nodemailer which will run on the same machine as the Postfix server, then it will forward that mail out to GMail. – klasiker Jan 11 '18 at 19:37
  • Ok, assuming that Nodemailer is only sending email, then you can simply use the hostname localhost to refer to your mail server (Postfix, as you say). – jpaugh Jan 11 '18 at 19:39
  • Forwarding to GMail might be tricky, since they might blacklist it as spam if they don't recognize the sending mail server. Alternately, you could use a local mail client (e.g. Thunderbird) to access your mail from the mail server; it will need to use the mail server's actual IP address to connect to it. – jpaugh Jan 11 '18 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.