Forms with node mailer not working

in my website contact form is working good in local host but after deploying it in netlify it says 404 error

Are you trying to use Netlify forms?

no i have used node mailer

I don’t see any usage of nodemailer in app1.js. I’m not sure how you’re using it.

see in server.js

const transporter = nodemailer.createTransport({
service: ‘gmail’,
port:465,
secure:true,
auth: {
type: ‘OAuth2’,
user: process.env.EMAIL,
pass: process.env.PASSWORD
}
})

hi @charanbolisetti ,

please do start a new thread for each separate problem you are trying to solve - this helps everyone work more efficiently to help you.

Also, do keep in mind that it is in everyone’s best interest that you supply as many details as possible and take the time to write a thorough, detailed, careful post. this makes it easier for everyone, but especially volunteers like hrishikesh.

server.js doesn’t exist in the publish path (public) folder and thus it’s not deployed. It’s not doing, as it’s just not there. Thus, it’s not working.

I haven’t really understood your build setup, the file structure, etc. It’s not a typical structure that I’m familiar with.

Actually if i keep server.js in public folder it doesn’t work in local host.
Shall i need to change any middleware in server.js.

As I said, I’m not sure what your build process it. Maybe you should consider using Netlify forms or you can also choose to use Functions. With Functions, you can keep your nodemailer setup. Then again, Netlify can’t keep a server running if that’s what you’re trying to do.

Hi, can you fixed this problem? I have same issued with you using nodemailer for contact form. when i work on local server is work fine.
(I am new for coding)

Hi @mim

Can you share the function code where you are using nodemailer, or a link to the repository you are deploying from? Could you also share a link to the site you are implementing this code on.