Unable to send SMTP mails using office365 settings Unable to send SMTP mails using office365 settings laravel laravel

Unable to send SMTP mails using office365 settings


Outlook doesn't provide to send using different from address other than your username to log in.

You need both email address same.

You can add one or more sender in your admin panel after that you can send easily from different addresses.


This error means the user whose credentials you specified in the SMTP connection cannot submit messages on behalf of the user specified in the From and/or Sender MIME headers or the FROM SMTP command.


I face the similar issue and i resolved it right now,you are most likely facing this issue because your "user" email in the auth option and the "from" email at the mail option are different

make the user and from email same and it will work for you

const transporter = nodemailer.createTransport({            service: 'outlook',            port: 587,            auth: {                user: 'abcde@outlook.com',                pass: '******'            },            tls: {                rejectUnauthorized: false            }        });        // setup email data with unicode symbols        let mailOptions = {            from: "abcde@outlook.com", // sender address            to: 'xyz@gmail.com', // list of receivers            subject: 'Node Contact Request', // Subject line            text: 'Hello world?', // plain text body            html: output // html body        };        // send mail with defined transport object        transporter.sendMail(mailOptions, (error, info) => {            console.log(info);            if (error) {                return console.log(error);            }            console.log('Message sent: %s', info.messageId);            console.log('Preview URL: %s', nodemailer.getTestMessageUrl(info));        });

If your email is not verified you will likely to get more errors