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?
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.273Forwarding 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