SMTPDebug = SMTP::DEBUG_SERVER; // for detailed debug output $mail->isSMTP(); // $mail->Host = 'smtp.gmail.com'; $mail->SMTPAuth = true; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; // $mail->Username = 'empirejute@slsgroup.co'; // YOUR gmail email // $mail->Password = 'SLS@123453a'; // YOUR gmail password $mail->Host = "smtp.office365.com"; $mail->SMTPAuth = true; $mail->Username = "tarun@swarnatech"; $mail->Password = "Stpl@12345"; $mail->SMTPSecure = "tls"; $mail->Port = 587; ; // Sender and recipient settings $mail->setFrom('empirejute@slsgroup.co', 'Sender Name'); $mail->addAddress('tarun_sadhukhan2@rediffmail.com', 'Receiver Name'); $mail->addReplyTo('example@gmail.com', 'Sender Name'); // to set the reply to // Setting the email content $mail->IsHTML(true); $mail->Subject = "Send email using Gmail SMTP and PHPMailer"; $mail->Body = 'HTML message body. Gmail SMTP email body.'; $mail->AltBody = 'Plain text message body for non-HTML email client. Gmail SMTP email body.'; $mail->send(); echo "Email message sent."; } catch (Exception $e) { echo "Error in sending email. Mailer Error: {$mail->ErrorInfo}"; } ?>