Sending email through exchange server using PHP
-
Saturday, March 10, 2012 12:25 AMI would like to use my hosted Exchange server to send mail, using my account, via a web application (written in PHP). I found an example using .net and c#, but nothing on PHP. To be clear, I want to use webDAV, not smtp to send and get verification. The Microsoft KB article on this topic is specific to .net. If anyone has a pointer to PHP examples, that would be great.
All Replies
-
Saturday, March 10, 2012 8:04 AM
Hi,
what about this code:
$url = "https://".$exchangeserver."/Exchange/".$domainuser."/drafts/".urlencode($comms_desc).".EML"; if (!$h->fetch($url, 0, null, $login, $domainpass, "PROPPATCH")) { echo "<h2>There is a problem with the http request!</h2>"; echo $h->log; exit(); } $g = new http(); $g->headers["Content-Type"] = 'text/xml; charset="UTF-8"'; $g->headers["User-Agent"] = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.1.4322)'; $g->headers["Cookie"] = 'sessionid='.$sessionid.'; cadata='.$cadata; $g->headers["Depth"] = "0"; $g->headers["Translate"] = "f"; $g->headers["Destination"] = "https://$exchangeserver/Exchange/$domainuser/##DavMailSubmissionURI##/"; if (!$g->fetch($url, 0, null, $login, $domainpass, "MOVE")) { echo "<h2>There is a problem with the http request!</h2>"; echo $g->log; exit(); } else { echo "<html> <head> <title>Send Email</title> </head> <body> Email Sent </body>"; }regards Thomas Paetzold visit my blog on: http://sus42.wordpress.com

