===== Setup SMTP Mail with Authentication in php.ini file on Windows IIS =====
*Make sure that you install Notepad++ to your windows server because native Notepad Windows app won't work for this.
*On the Windows web server, locate the PHP installation folder. Example c:\php\
*Open the php.ini file using Notepad++ editor (right click php.ini and left click "open with" and select Notepad++).
*Search for, add or modify the [mail function] section of php.ini as follows:
[mail function]
; For Win32 only.
; http://php.net/smtp
; SMTP = localhost REM-OUT 10-28-2017 INSERT NEXT LINE INSTEAD
SMTP = your.mailservername.tld
; http://php.net/smtp-port
smtp_port = 25
; REMARK - INSERT NEXT TWO LINES TO AUTHENTICATE THROUGH EXISTING EMAIL ACCOUNT ON SMTP SERVER
auth_username = mailuser@yourdomain.tld
auth_password = password_of_your_mailuser
; For Win32 only.
; http://php.net/sendmail-from REMARK - INSERT AND UN-COMMENT NEW LINE HERE BASED ON EXAMPLE
;sendmail_from = me@example.com
sendmail_from = no_reply@yourmaildomain.tld
*Save the php.ini file with those changes.
*Restart the World Wide Web service -- Internet Information Services
==== Create a PHP Test Mailer File ====
*In some web folder on your php-enabled web site, create a text file named "phpmailtester.php"
*Open that file with Notepad++ and insert the following php code, but change your test recipient's email address.
*Access the file from your website using any web browser.
*Note: The page will be empty, but you should check your recipient email account to see whether the test mail arrived. Also view the headers or source code of the test email to see the route taken.
==== Download my example of phpmailtester.php file and modify it accordingly ====