I'm trying to send some emails from a docker container running express 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);
}
}
}
That's working all fine if I run the express with npm start but If I run it with docker it'll fail with this error Error: Connection closed
It only fails using smtp.reg.356.net, if I use Gmail it'll work perfectly
This is the docker file I'm 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 requested, running telnet smtp.reg365.net 25 returns this telnet: could not resolve smtp.reg.356.net/25: Name or service not known
Output of cat /etc/resolv.conf on the host machine
domain Hitronhub.home
nameserver 89.101.160.5
nameserver 89.101.160.4
On the docker container
search hitronhub.home
nameserver 127.0.0.11
options ndots:0