Hello, I am wondering how i would connect PHP to Microsoft Exchange? I have a form set up that when it gets submitted i want it to be emailed to a certain person the problem im having is im not sure how i would get the connection to exchange.

Microsoft Exchange has SMTP services just like most other mail platforms. Just get the hostname from your mail administrator and develop your PHP code to send mail to this SMTP address as you would any other smtp host.

Exchange has an authorization module in the settings, and you can allow your IP to send emails trough it without authentification.
The simplest methods is the SMTP with the Exchange domain name if its in the lan or the Exchange IP.

Hi,

try ....>>

Open your php.ini file and tell us what are the value assigned to mail directives

[mail function]

we need to see the entire block..
go to code.google.com and search for phpmailer

Back to your server locate which mailer is installed e.g. mercury, etc

In the same level as your php directory find sendmail directory.. in linux this is normally located in the etc directory, but different php application preferences can change the exact location sometimes it is inside the bin directory. YOu just need to know the locations of things in your own server.

in send mail directory find sendmail.ini
load sendmail.ini to gedit or notepad++ find [sendmail] directives

Within the [sendmail] block define

smtp_server=localhost
smtp_port=25
;auth_username=
;auth_password=

change it to something like this..example below uses the smtp.gmail..you can user yahoo, or msn.. the choice is yours..

smtp_server=smtp.gmail.com
smtp_port=587
auth_username= YourAccountUserName@gmail.com
auth_password= YourGmailAccountPassword

Go back to your PHP.ini file and set the mail function directives to this.. it should be the as what we have on the sendmail block.

SMTP = smtp.gmail.com
smtp_port = 587
sendmail_from = YourAccountUserName@gmail.com   

Restart your server..

Run your php mailer script..

If you will using the gmail smtp port, make sure you logon to your google email account and click on the red bar confirmation on top of the page, and authorize your server IP to use the smtp OTHERWISE! your server IP is going to be ban by gmail.

If you will be using MSN or Yahoo, make sure you provide the proper smtp port.

Would this be the way to set up the exchange with SMTP?Click Here

I didnt watch the whole video but the title does indicate Exchange Relay services. That is correct. You need your Exchange server to run SMTP services and relay mail.

If you are the mail administrator, be aware that you need to secure your relay. If its not secured and spammers find your open relay, they will be very happy to send out spam through your relay and your IP will be blacklisted and your ISP will not be too happy with you.

Thanks everyone for you help i will try and get that set up now

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.