I am trying to send multiple emails from a docker container working through register365.
This is the code used
export class Emailer { transporter: nodemailer.Transporter; constructor() { this.transporter = nodemailer.createTransport(smtpTransport({ host: 'smtp.reg365.net', auth: { user: 'myuser', pass: mypassword' } })); } public async sendEmail(to,body) { try { return await this.transporter.sendMail({to,from: '"TEST" < user@myuser.ie >',text: body, subject: ' WE NEED THE CONTENT AND DESIGN OF THIS EMAIL!!!!'}); } catch(error) { console.log('Email error'); console.dir(error); } } }
This works fine if I run express with npm, but if I run it with docker, it will fail with this error Error: Connection closed
It only fails using smtp.reg.356.net, if I use Gmail it will work fine
This is the docker file that I am using
FROM node:8 RUN mkdir -p /usr/src/app WORKDIR /usr/src/app RUN npm install -g nodemon COPY package.json /usr/src/app/ RUN npm install COPY ./dist /usr/src/app/dist EXPOSE 3005 EXPOSE 25 CMD [ "npm", "start" ]
Many thanks.
EDIT: As required, running telnet smtp.reg365.net 25 returns this telnet: could not resolve smtp.reg.356.net/25: Name or service not known
Output from cat / etc / resolv.conf on the host machine
domain Hitronhub.home nameserver 89.101.160.5 nameserver 89.101.160.4
In a docker container
search hitronhub.home nameserver 127.0.0.11 options ndots:0
troyz
source share