CDONTS is mail component used to send messages from an ASP page. Instead of recoding multiple web sites I have created, I am just going to install the component on my Windows Server 2008.
Configuration Information
Platform: Hyper V Host (http://www.microsoft.com/windowsserver2008/en/us/hyperv.aspx)
OS: Windows Server 2008
Installation Media: CDONTS.zip – You can download the version I used here.
CPU: 2 dedicated 2.0Ghz
RAM: 1024mb
Disk: 40GB
Notes: IIS 7 has already been installed
Background
You can see here sendmail.asp is calling CDONTS when it creates the message.
-----------This is just an example---------
Dim bodyText
bodyText = "..............." & vbcrlf
'Some text here for variable value
bodyText= boxyText & "End of mail"
Set objMail = Server.CreateObject("CDONTS.Newmail")
.....
.....
.....
-------------------------------------
If CDONTS is not installed and I press send on my mail form I get this error
Server Error
Internal Server Error
There is a problem with the resource you are looking for, and it cannot be displayed.
Installing CDONTS
Copy CDONTS.dll to c:\windows\system32 (You can download the version I used here)
Open the command prompt and run "regsvr32 c:\windows\system32\cdonts.dll"
Press OK when registration succeeds
Installing SMTP
Open Server Manager, you can open this several different ways in Windows Server 2008. Probably the quickest way to open Server Manager is to right click "My Computer" and choose "Manage", another way is open "Control Panel" go to "Program and Features" and select "Turn Windows features on or off". A third way to open it is "Server Manager" option under Administrative Tools.
Under Features, select Add Roles
Check the check box off next to "SMTP Server"
IIS will figure out what else it needs and create a list of required features, Press "Add Required Features"
Now there should be a check in the check box next to "SMTP Server", Press "NEXT" to continue
Press "Install" to continue with the installation
You should see a message indicating the Installation has succeeded, Press "Close" to continue
Configure SMTP Server
Make sure when you when you install the SMTP service, you enable Relay for localhost. Go to Administrative Tools > Internet Information Services (IIS6) > SMTP Virtual Server > Right click, Properties > Access Tab > Relay button > Add 127.0.0.1 in the option
Configure SMTP Security
Grant the appropriate permissions on C:\inetpub\mailroot\pickup (I granted USERS group Modify permissions). You could get permission denied if the folder security isn’t adjusted.
Testing
This is my contact form that uses the CDONTS component
No more 500 error, the message was sent out successfully
You can also test using the using the following code in an ASP page. Here is the code to test CDONTS in an ASP page.
Create a TEST.ASP with the following code and put the file in C:\Inetpub\wwwroot. Change the "CDONTSMail.To=" value to your e-mail address. Navigate to http://localhost/test.asp, if all is configured ok then you should receive the mail message. If you do not receive the e-mail check the folders under c:\inetpub\mailroot to see if its queued up.
<%
Dim strBody
Dim CDONTSMail
Set CDONTSMail = CreateObject("CDONTS.NewMail")
CDONTSMail.From= "user@example.com"
CDONTSMail.To= "user@example.com"
CDONTSMail.Subject="This is a Test email"
strBody = "This is a test message." & vbCrLf
CDONTSMail.Body= strBody
CDONTSMail.Send
set CDONTSMail=nothing
%>
⭐ If you would like to buy me a coffee, well thank you very much that is mega kind! :
https://www.buymeacoffee.com/honeyvig
Hire a web Developer and Designer to upgrade and boost your online presence with cutting edge Technologies
Showing posts with label SMTP. Show all posts
Showing posts with label SMTP. Show all posts
Tuesday, March 1, 2011
Install and Configure FastCGI & PHP 5.2.9 on (IIS 7) Windows Server 2008
In this article I will install and configure both FastCGI and PHP 5.2.9 on IIS7. You can configure PHP to use an ISAPI filter or CGI, on my old 2003 server I had it running as an ISAPI filter and it worked just fine. On my new 2008 server I am going to attempt to run the requests through Fast-CGI.exe, which should be faster than a filter.
Configuration Information
Platform: Hyper V Host (http://www.microsoft.com/windowsserver2008/en/us/hyperv.aspx)
OS: Windows Server 2008
Installation Media: PHP 5.2.9 was downloaded from http://www.php.net/downloads.php
CPU: 2 dedicated 2.0Ghz
RAM: 1024mb
Disk: 40GB
Notes: a base installation of IIS 7 has already been installed, that installation is covered here.
Installing CGI on IIS 7
You will first need to install CGI on IIS 7 before you install PHP. Installing CGI also installs FastCGI which we need for PHP to work correctly.
Open Server Manager, you can open this several different ways in Windows Server 2008. Probably the quickest way to open Server Manager is to right click "My Computer" and choose "Manage", another way is open "Control Panel" go to "Program and Features" and select "Turn Windows features on or off". A third way to open it is "Server Manager" option under Administrative Tools.
Under Roles, select "Add Roles"
Select "CGI" and press "Next"
Press "Install" to install CGI
CGI will begin its installation
After the installation succeeds, press "Close"
Under "Roles" you should now see CGI installed. Now it’s time to install PHP
Installing PHP 5.2.9
Launch "php-5.2.9-win32-installer.msi". Press "Next" to continue
Accept the terms of the license agreement by checking the checkbox, press "Next" to continue
Install PHP under C:\PHP\. You can install it under whichever directory you choose, what I have learned is C:\PHP works the best. Press "Next" to continue
Select "IIS FastCGI". Press "Next" to continue
Right click PHP and choose "Entire feature will be installed on local hard drive". It’s OK to install ALL of the extensions, we will only enable the ones we need in PHP.ini when we are done.
Press "Next" to continue
PHP is ready to install, press "Install" to begin installation
Set up will copy all the files and do what it needs to do
Do not worry about this error, IIS does not have httpd.conf file Apache does.
"Error trying access httpd.conf file. You need to manually configure the server"
Press "Finish"
-------------------------
Configuring PHP 5.2.9 on IIS 7
Open PHP.ini, which is located in C:\PHP or wherever you installed PHP. You can open it with Notepad
Change "open_basedir" value to the following:
open_basedir = C:\inetpub
Go down to the extensions section, which should be at the bottom I commented out EVERY extension by adding a ; (semi-colon) in front of the extensions name. I did this for ALL of the extensions except for the following:
extension=php_curl.dll
extension=php_gd2.dll
extension=php_interbase.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
extension=php_mysql.dll
I needed to use php_mysql.dll because I am using MySQL for the database. If you are using a different DB you will need to load the appropriate DLL
Please keep in mind: IF YOU GET ERRORS (i.e. an IIS 500 error) most likely you have an extension enabled that your server does not like!
Save your PHP.ini file now
Testing PHP at the command prompt
Open a command prompt. Navigate to the directory you installed PHP to.
Type in: PHP –info and you should see a lot of scrolling and information. This means PHP is good to go.
Below is the start of the command and output, then the second picture is the last thing that will be shown.
Configuring IIS 7.0
Open IIS and click on "Handler Mappings"
Verify there is a handler mapping for *.php. 5.2.9 includes this in the installation package, before this you had to create one manually.
If you go to the properties you can see it maps *.php files to use C:\PHP\php-cgi.exe. Cool!
Testing PHP in a Browser
Navigate to the default site directory at C:\inetpub\wwwroot. Create a file called "info.php" and place the following in the file:
Open your browser and point it at http://localhost/info.php and you should see a PHP information page similar to this:
Again, If you receive a 500 error it might be because of one of the extensions you have enabled.
Configuration Information
Platform: Hyper V Host (http://www.microsoft.com/windowsserver2008/en/us/hyperv.aspx)
OS: Windows Server 2008
Installation Media: PHP 5.2.9 was downloaded from http://www.php.net/downloads.php
CPU: 2 dedicated 2.0Ghz
RAM: 1024mb
Disk: 40GB
Notes: a base installation of IIS 7 has already been installed, that installation is covered here.
Installing CGI on IIS 7
You will first need to install CGI on IIS 7 before you install PHP. Installing CGI also installs FastCGI which we need for PHP to work correctly.
Open Server Manager, you can open this several different ways in Windows Server 2008. Probably the quickest way to open Server Manager is to right click "My Computer" and choose "Manage", another way is open "Control Panel" go to "Program and Features" and select "Turn Windows features on or off". A third way to open it is "Server Manager" option under Administrative Tools.
Under Roles, select "Add Roles"
Select "CGI" and press "Next"
Press "Install" to install CGI
CGI will begin its installation
After the installation succeeds, press "Close"
Under "Roles" you should now see CGI installed. Now it’s time to install PHP
Installing PHP 5.2.9
Launch "php-5.2.9-win32-installer.msi". Press "Next" to continue
Accept the terms of the license agreement by checking the checkbox, press "Next" to continue
Install PHP under C:\PHP\. You can install it under whichever directory you choose, what I have learned is C:\PHP works the best. Press "Next" to continue
Select "IIS FastCGI". Press "Next" to continue
Right click PHP and choose "Entire feature will be installed on local hard drive". It’s OK to install ALL of the extensions, we will only enable the ones we need in PHP.ini when we are done.
Press "Next" to continue
PHP is ready to install, press "Install" to begin installation
Set up will copy all the files and do what it needs to do
Do not worry about this error, IIS does not have httpd.conf file Apache does.
"Error trying access httpd.conf file. You need to manually configure the server"
Press "Finish"
-------------------------
Configuring PHP 5.2.9 on IIS 7
Open PHP.ini, which is located in C:\PHP or wherever you installed PHP. You can open it with Notepad
Change "open_basedir" value to the following:
open_basedir = C:\inetpub
Go down to the extensions section, which should be at the bottom I commented out EVERY extension by adding a ; (semi-colon) in front of the extensions name. I did this for ALL of the extensions except for the following:
extension=php_curl.dll
extension=php_gd2.dll
extension=php_interbase.dll
extension=php_mbstring.dll
extension=php_mcrypt.dll
extension=php_mysql.dll
I needed to use php_mysql.dll because I am using MySQL for the database. If you are using a different DB you will need to load the appropriate DLL
Please keep in mind: IF YOU GET ERRORS (i.e. an IIS 500 error) most likely you have an extension enabled that your server does not like!
Save your PHP.ini file now
Testing PHP at the command prompt
Open a command prompt. Navigate to the directory you installed PHP to.
Type in: PHP –info and you should see a lot of scrolling and information. This means PHP is good to go.
Below is the start of the command and output, then the second picture is the last thing that will be shown.
Configuring IIS 7.0
Open IIS and click on "Handler Mappings"
Verify there is a handler mapping for *.php. 5.2.9 includes this in the installation package, before this you had to create one manually.
If you go to the properties you can see it maps *.php files to use C:\PHP\php-cgi.exe. Cool!
Testing PHP in a Browser
Navigate to the default site directory at C:\inetpub\wwwroot. Create a file called "info.php" and place the following in the file:
Open your browser and point it at http://localhost/info.php and you should see a PHP information page similar to this:
Again, If you receive a 500 error it might be because of one of the extensions you have enabled.
Labels:
IIS 7.0,
PHP,
SMTP,
Windows 2008
Subscribe to:
Posts (Atom)