"use strict";
(() => {
var exports = {};
exports.id = 91;
exports.ids = [91];
exports.modules = {

/***/ 3414:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "default": () => (/* binding */ contact)
});

;// CONCATENATED MODULE: external "nodemailer"
const external_nodemailer_namespaceObject = require("nodemailer");
var external_nodemailer_default = /*#__PURE__*/__webpack_require__.n(external_nodemailer_namespaceObject);
;// CONCATENATED MODULE: ./pages/api/contact.js

const email = "rahul23.exam@gmail.com";
const pass = "xuyfcvfanpynqbhl";
const handler = async (req, res)=>{
    console.log("requestd");
    if (req.method === "POST") {
        const data = req.body;
        // if (!data || !data.name || !data.email || !data.subject || !data.message) {
        //     return res.status(400).send({ message: "Bad request" });
        // }
        try {
            let transporter = external_nodemailer_default().createTransport({
                service: "gmail",
                auth: {
                    user: email,
                    pass
                }
            });
            // send mail with defined transport object
            let info = await transporter.sendMail({
                from: `"Company Name" <${email}>`,
                to: "rahulc2303@gmail.com",
                subject: "OTP",
                html: `
                <div>  
                   <div style="margin-top: 50px">
                    message:${data.message}
                  </div>
                </div>
    
                `
            });
            return res.status(200).json({
                success: true
            });
        } catch (err) {
            console.log(err);
            return res.status(400).json({
                message: err.message
            });
        }
    }
    return res.status(400).json({
        message: "Bad request"
    });
};
/* harmony default export */ const contact = (handler);


/***/ })

};
;

// load runtime
var __webpack_require__ = require("../../webpack-api-runtime.js");
__webpack_require__.C(exports);
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
var __webpack_exports__ = (__webpack_exec__(3414));
module.exports = __webpack_exports__;

})();