Table of Contents

Setup SMTP Mail with Authentication in php.ini file on Windows IIS

[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

Create a PHP Test Mailer File

<?php
//REMARKS -sending email with the php mail() funtion
//REMARKS -THE COMMA-SEPARATED SINGLE-QUOTE 'DELIMITED' FIELDS OF THE mail() function BELOW: 
//FIELDS - mail('RECIPIENT_EMAIL','SUBJECT','BODY');
mail('recipient@somedomain.tld', 'Test Email using PHP', 'A message in the body of the test email');
?>

Download my example of phpmailtester.php file and modify it accordingly

phpmailtester.php
<?php
//REMARKS -sending email with the php mail() funtion
//REMARKS -THE COMMA-SEPARATED SINGLE-QUOTE 'DELIMITED' FIELDS OF THE mail() function BELOW: 
//FIELDS - mail('RECIPIENT_EMAIL','SUBJECT','BODY');
mail('recipient@somedomain.tld', 'Test Email using PHP', 'A message in the body of the test email');
?>