I developing my website. i have sending mail function in contact tab and i do that with nodemailer. i published my site but i can not send mail from mobile phone while i can send mail with on pc browsers.
here is my nodemailer's code.
const express = require('express');
const bodyParser = require('body-parser');
const nodemailer = require('nodemailer');
const cors = require('cors');
const { response } = require('express');
const app = express();
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.use(cors());
app.get('/', ()=> {
resizeBy.send('welcome to my form')
})
app.post('/api/form', (req, res)=>{
let data = req.body
let smtpTransport = nodemailer.createTransport({
service: 'gmail',
port:465,
auth:{
user:"xxxxxx@gmail.com",
pass:'xxxxxx'
}
});
let mailOptions={
from:data.email,
to:'xxxxxxxx@gmail.com',
subject:`from BLOG`,
html:`
<h3 style="text-decoration:underline;">Informations</h3>
<p style="padding: 10px 10px"> ${data.message}</p>
`
};
smtpTransport.sendMail(mailOptions, (error,response)=>{
if(error){
res.send(error)
}
else{
res.send('Success')
}
})
smtpTransport.close();
})
const PORT = process.env.PORT||3001;
app.listen(PORT,()=>{
console.log(`Server starting at port ${PORT}`);
})