Postfix system mail name when on local PC

0

1

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?

klasiker

Posted 2018-01-11T18:31:20.363

Reputation: 101

Answers

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.

jpaugh

Posted 2018-01-11T18:31:20.363

Reputation: 1 212

A friend advised me to use my public IP address. Does this sound correct? – klasiker – 2018-01-11T19:31:54.440

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 – 2018-01-11T19:35:53.830

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 – 2018-01-11T19:37:31.043

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 – 2018-01-11T19:39:55.273

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 – 2018-01-11T19:41:03.393