PHP Mailer Not Sending Email To Office365 -


i want send mail office365 using phpmailer not sending , giving me connect() error here code:

email , password i'm using in real code working

require 'mailer/phpmailerautoload.php'; $mail = new phpmailer(); $mail->issmtp(); $mail->mailer = 'smtp'; $mail->smtpauth = true; $mail->host = 'smtp.office365.com'; // "ssl://smtp.gmail.com" didn't worked $mail->port = 587; $mail->smtpsecure = 'tls'; // or try these settings (worked on xampp , wamp): // $mail->port = 587; // $mail->smtpsecure = 'tls';   $mail->username = "email"; $mail->password = "password";  $mail->ishtml(true); // if going send html formatted emails $mail->singleto = true; // if want send same email multiple users. multiple emails sent one-by-one.  $mail->username = "mail@gmail.com"; $mail->fromname = "your name";  $mail->addaddress("abc@gmail.com","user 1");   $mail->subject = "testing phpmailer localhost"; $mail->body = "hi,<br /><br />this system working perfectly.";  if(!$mail->send()) {     echo "message not sent <br />phpmailer error: " . $mail->errorinfo; } else{     echo "message has been sent"; } 

the output is

message not sent phpmailer error: smtp connect() failed. https://github.com/phpmailer/phpmailer/wiki/troubleshooting


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -