SMTP setting on IIS7 and PHP

IIS vs PHP

Since my new role on the new office made me to have more contact with PHP and IIS,

i will try to share some trick and tips to bridging those two platform

This week I spend more than two days to figuring out how to using PHP mail function under IIS7

previously I have configure phpmail setting under xampp platform, on that platform you only need to make sure PHP.ini and sendmail.ini is working good.

but on IIS you need to install smtp service on the server.

and Finally I found this GREAT tutorial from LEARN.IIS.NET

Fyi LEARN.IIS.NET is very reliable website for you that want to search anything.. yap anything about IIS especially IIS7

so this is the problem. I need to have my email notification from TYPO3 to be work on my IIS server, my email server is on the other location and it need login authentication (username and password).

first of all, you need to check php.ini configuration

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
sendmail_from = me@example.com
; configuration above will use your smtp server as the bridge to remote smtp server

Install SMTP on your server

and configure it correctly

You can find detail step here

then you can use code bellow for testing

<?php
$to = “me@example.com”;
$subject = “Test mail”;
$message = “Hello! This is a simple email message.”;
$from = “me@example.com”;
$headers = “From:” . $from;

if (mail($to,$subject,$message,$headers)) {
echo(“<p>Message successfully sent!</p>”);
} else {
echo(“<p>Message delivery failed…</p>”);
}
?>

happy codding …

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.