Yesterday I needed to send an email from a php page to an email address, sounded simple enough but when I tried it it did not work, so after a bit of searching I found lots of people having the same issues but no simple instructions to get it working.
Here are the simple instructions.
My Setup:
Ubuntu Server default install with lamp.
Exchange server installed on a different server.
The steps taken:
1) Install sendmail
from the terminal
sudo apt-get install sendmail
2) Edit php.ini
from the terminal
sudo vim /etc/php5/apache2/php.ini
approx line 1059 change
;sendmail_path =
to
sendmail_path = /usr/sbin/sendmail -t -i
write changes and exit
3) restart apache2
from the terminal
sudo /etc/init.d/apache2 restart
4) edit hosts file
from the terminal
sudo vim /etc/hosts
near the top add
127.0.0.1 hostname.local hostname
where hostname = your hostname
5) Create your php test page
from termianl
sudo vim /var/www/mail.php
add code
Write changes and exit
6) From a machine with a web browser access the mail.php.
ALL DONE
If you find anything in my blog useful or interesting please just drop me a comment.
Tuesday, May 22, 2012
Monday, February 27, 2012
Playing Diablo 2 on Windows 7
Just a quick one today.
Tried playing an old favorite Diablo 2 on Windows 7 today and found it has issues, mainly screwing up the colours on the game.
The fix is simple, all it involves is making sure explorer is stopped while the game is being played.
1) Create a batch file in the diablo 2 folder
2) Edit the batch file to match the following:
taskkill /f /im explorer.exe
game.exe
explorer.exe
3) Save and exit.
4) Change any shortcuts to point to this file instead of game.exe
Enjoy the classic game.
Tried playing an old favorite Diablo 2 on Windows 7 today and found it has issues, mainly screwing up the colours on the game.
The fix is simple, all it involves is making sure explorer is stopped while the game is being played.
1) Create a batch file in the diablo 2 folder
2) Edit the batch file to match the following:
taskkill /f /im explorer.exe
game.exe
explorer.exe
3) Save and exit.
4) Change any shortcuts to point to this file instead of game.exe
Enjoy the classic game.
Thursday, January 26, 2012
VB6 Authenticate user against AD
Now I know VB6 is old, but it still works and is easy to quickly write an app, well I thought so until this morning when I needed a simple app that can verify a username and password on my domain. In PHP it is a simple ldap query and the user is verified, trying the same thing in VB6, no chance, it works fine if you are logged on to a domain machine, or there is a way if you are logged on locally to a domain machine, but if your machine is not part of the domain it is a pain in the rear.
After trying for an hour, reading many pages on the web, I finally gave up and went to do something simple (clear the filter in a projector.) Then an idea hit me which works and is very simple.
It goes as follows:
1) find the address of any share on the domain which all users have read access to.
2) In VB6 map the share using supplied credentials.
3) If successful, Congrats the user is verified! unmap the share.
4) If not successful deal with the error.
Finished.
Code as follows:
Dim objnetwork As Object
Set objnetwork = CreateObject("WScript.Network")
On Error Resume Next
objnetwork.MapNetworkDrive "H:", "\\server\share", "false", username.text, password.text
objnetwork.RemoveNetworkDrive "H:"
If Err <> 0 Then
msgbox = "Invalid Username or Password"
Else
'code here for successful logon
End If
End of Code
That is it, no extra declarations no modules, no ldap naming convention, just simple code easy to use with 2 text boxes and a command button.
After trying for an hour, reading many pages on the web, I finally gave up and went to do something simple (clear the filter in a projector.) Then an idea hit me which works and is very simple.
It goes as follows:
1) find the address of any share on the domain which all users have read access to.
2) In VB6 map the share using supplied credentials.
3) If successful, Congrats the user is verified! unmap the share.
4) If not successful deal with the error.
Finished.
Code as follows:
Dim objnetwork As Object
Set objnetwork = CreateObject("WScript.Network")
On Error Resume Next
objnetwork.MapNetworkDrive "H:", "\\server\share", "false", username.text, password.text
objnetwork.RemoveNetworkDrive "H:"
If Err <> 0 Then
msgbox = "Invalid Username or Password"
Else
'code here for successful logon
End If
End of Code
That is it, no extra declarations no modules, no ldap naming convention, just simple code easy to use with 2 text boxes and a command button.
Subscribe to:
Posts (Atom)