Is it possible to change the SMTP information in the php.ini file to point to Microsoft's Live email SMTP servers?

StackOverflow https://stackoverflow.com/questions/17978250

  •  04-06-2022
  •  | 
  •  

Domanda

Here's what's in my php.ini file:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25

Is it possible to simply change localhost to smtp.live.com and change the port (smtp_port) to point to a different port (specifically, 567, as required by Microsoft) in order to send email to a Microsoft Live email address via PHP? I tried the normal mail() route, but I never received the email from the script, and can only assume it has to do with SMTP authentication. I don't have very much experience with PHP.

È stato utile?

Soluzione

No, that won't work. smtp.live.com requires authentication, and the PHP mail() command does not support authentication. As Pascamel suggested, you should use a library that supports sending mail through a remote SMTP server using authentication. phpmailer is very good.

Altri suggerimenti

Have a look at PHPMailer : https://github.com/PHPMailer/PHPMailer

I'm using it to send emails through a GMail account, settings are pretty easy!

This way you won't have to update your php.ini

in php.ini you can change smtp server to different server ONLY for WINDOWS machines. You can't do it for unix machines. it just ignores even if you set smtp = yourserver.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top