This is a discussion on Send Mail From Outlook Web Access within the PHP Language forums, part of the PHP Programming Forums category; I've got RH9 Linux with default PHP. Is there a way to send email on Linux to an Exchange ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I've got RH9 Linux with default PHP.
Is there a way to send email on Linux to an Exchange Server from PHP and/or other tools when there is *NOT* SMTP access? Has anyone figured out a way to use PHP to get inside an OWA (Microsoft Outlook Web Access) website to send email that way? The reason I ask is because my corporate office is going to do away with our rogue SMTP server access and force everything through Exchange Server. This makes it hard for our batch scripts on the Linux server to relay to internal email accounts that a job has failed or other errors. |
|
|||
|
Google Mike wrote:
> > Is there a way to send email on Linux to an Exchange Server > from PHP and/or other tools when there is *NOT* SMTP access? I'm lost... If you don't have SMTP access to an Exchange Server, is there a guarantee you can have any other kind of access? > Has anyone figured out a way to use PHP to get inside an OWA > (Microsoft Outlook Web Access) website to send email that way? Not that I heard of, but it should be doable via cURL or even fsockopen(). > The reason I ask is because my corporate office is going > to do away with our rogue SMTP server access and force > everything through Exchange Server. Again, Exchange Server can (and does) provide SMTP service... Can you explain the problem in a little more detail? In particular, are the Exchange Server and your Linux machine on the same LAN? Cheers, NC |
|
|||
|
"Google Mike" <googlemike@hotpop.com> wrote in message news:1109095078.006024.230980@l41g2000cwc.googlegr oups.com... > I've got RH9 Linux with default PHP. > > Is there a way to send email on Linux to an Exchange Server from PHP > and/or other tools when there is *NOT* SMTP access? > > Has anyone figured out a way to use PHP to get inside an OWA (Microsoft > Outlook Web Access) website to send email that way? > > The reason I ask is because my corporate office is going to do away > with our rogue SMTP server access and force everything through Exchange > Server. This makes it hard for our batch scripts on the Linux server to > relay to internal email accounts that a job has failed or other errors. > Not something I've tried. According to Microsoft, all Exchange functionalities are expose through XML and HTTP/DAV. So in theory, you can send a message without SMTP. Here's a good introductory article: http://msdn.microsoft.com/library/de...devwebapps.asp |
|
|||
|
"Google Mike" <googlemike@hotpop.com> wrote in message news:1109095078.006024.230980@l41g2000cwc.googlegr oups.com... > I've got RH9 Linux with default PHP. > > Is there a way to send email on Linux to an Exchange Server from PHP > and/or other tools when there is *NOT* SMTP access? > > Has anyone figured out a way to use PHP to get inside an OWA (Microsoft > Outlook Web Access) website to send email that way? > > The reason I ask is because my corporate office is going to do away > with our rogue SMTP server access and force everything through Exchange > Server. This makes it hard for our batch scripts on the Linux server to > relay to internal email accounts that a job has failed or other errors. > Actually, it appears that OWA works with non-IE browsers. You should be able to post a message via a regular HTTP post. My suggestion is to download a HTTP logging tool from somewhere, and examine the transaction between Firefox and OWA when a message is sent to see what need to be done. If you have a relatively recent version of PHP, doing a HTTP post with authentication info is fairly easy. Just take a look at http://www.php.net/stream_context_create/ |
|
|||
|
Yeah. I think I'll try that. You reminded me that I don't have to just
do this from Windows which has like zero tools for monitoring HTTP traffic. I can do it from Mozilla and Linux. Duh. (Pinching myself because I forgot about that! :) ) So, I just need to see if I can find an HTTP logging tool for Linux. Got any suggestions? Oh, and the good news is that my office has this enabled over HTTP, not HTTPS, so I can actually read the traffic. They enable it over HTTP for intranet, and HTTPS for when we're outside the office. |
|
|||
|
"Google Mike" <googlemike@hotpop.com> wrote in message news:1109218418.306478.196210@o13g2000cwo.googlegr oups.com... > Yeah. I think I'll try that. You reminded me that I don't have to just > do this from Windows which has like zero tools for monitoring HTTP > traffic. I can do it from Mozilla and Linux. Duh. (Pinching myself > because I forgot about that! :) ) So, I just need to see if I can find > an HTTP logging tool for Linux. Got any suggestions? > > Oh, and the good news is that my office has this enabled over HTTP, not > HTTPS, so I can actually read the traffic. They enable it over HTTP for > intranet, and HTTPS for when we're outside the office. > There's a Mozilla extension called livehttpheaders. I've never used it myself, but it's probably worth a try. Just Google for it. |
|
|||
|
To get into OWA, I did some tests by using Linux, Mozilla (with proxy
turned on to self), and then fired up the Squid proxy for Linux. I disabled strip_query_terms in squid.conf so that I could see the full URL. Here's what I found in the /var/log/squid/acccess.log file after using OWA to send a message. (Also look for my further comments below this.) GET http://webmail/ GET http://webmail/exchange/logon.asp GET http://webmail/exchange/LogonFrm.asp...Google%2C+Mike GET http://webmail/exchange/LogonFrm.asp...Google%2C+Mike GET http://webmail/exchange/root.asp GET http://webmail/exchange/Navbar/nbInbox.asp GET http://webmail/exchange/inbox/main_f...re=0&obj=&acs= GET http://webmail/exchange/inbox/title....pidx=0&store=0 GET http://webmail/exchange/inbox/peerfl...890000&store=0 GET http://webmail/exchange/inbox/messag...890000&store=0 GET http://webmail/exchange/inbox/comman...othing&store=0 GET http://webmail/exchange/images/envelope.gif GET http://webmail/exchange/forms/ipm/no...nd=new&store=0 GET http://webmail/exchange/forms/ipm/no...=1&att=0&imp=1 GET http://webmail/exchange/forms/ipm/no...12136&caller=1 GET http://webmail/exchange/forms/ipm/no....asp?obj=12136 POST http://webmail/exchange/forms/ipm/note/commands.asp # The above POST, if done in GET format, would probably be: http://webmail/exchange/forms/ipm/no...1&importance=1 GET http://webmail/exchange/logoff.asp One of the first things that happens is Basic Authentication. (Note that NTLM Authentication is just Basic Authentication pointed at a Active Directory or SAM security file.) That means that one has to pass a Basic Auth header when trying to login on to LogonFrm.asp. I think some of these URLs I might not even be required to hit in order to acquire the proper session ID on the server or the proper cookie information. For instance, I would reason to bet that the long HEX info ?obj= in some of the URLs above is not even a necessary page one needs to hit in order to send out email. If it is, then perhaps one of the prior pages passes this information. I also think all the magic happens in commands.asp in that POST. Since I know that often times you can replace a POST with a GET to debug things, I believe the above replacement for the POST just might work. Otherwise one will have to pass a form to the commands.asp. The only cookie I received was on the webmail/logon.asp page, and it was just an ordinary session ID. Perhaps some of the prior pages to commands.asp updates the server's session cookie with other information -- I don't know. Meanwhile, watch out for the objID parameter in the URL -- that's uniquely identified each time. I believe one of the prior pages provides that value and this must be reused in order for the email to go out. |