Installing Fake Sendmail for Windows: Difference between revisions

Jump to navigation Jump to search
Minor grammar changes, and some rewriting for clarity
mNo edit summary
(Minor grammar changes, and some rewriting for clarity)
Line 13: Line 13:
'''Uniform Server 3.5-Apollo.'''
'''Uniform Server 3.5-Apollo.'''
|}
|}
PHP’s mail function is extremely easy to use, on the [[PHP mail function | previous page (Solution 1)]] I have shown what modification are required to the '''php.ini''' file to get it up and running with your host's SMTP server. However it '''fails''' if your host requires '''authentication''', to the rescue '''Fake sendmail for Windows'''.
'''''Note'':''' Uniform Server [[5.3-Nano: msmtp | '''5-Nano''']] has '''msmtp''' mail client integrated. This is a ready alternative to “fake sendmail”.


Unix users take all this stuff for granted; its there and they well just send emails. When they try to set '''sendmail "-t"''' on Windows, its not there, so what do you think they do! Yep write something useful like “fake sendmail” by '''Byron Jones''' and give it to the community. The latest software “fake sendmail for windows” can be found here '''[http://glob.com.au/sendmail/ glob.com.au]'''
PHP’s mail function is extremely easy to use. On the [[PHP mail function | previous page (Solution 1)]] I have shown what modification are required to the '''php.ini''' file to get it to work with your host's SMTP server. However it '''fails''' if your host requires '''authentication'''. '''Fake sendmail for Windows''' to the rescue.


'''''Note'':''' Please note Uniform Server [[5.3-Nano: msmtp | '''5.2-Nano and 5.3-Nano''']] has '''msmtp''' mail client integrated this is an alternative to “fake sendmail”.
Unix users take all this stuff for granted; it's there and they just send emails. When they try to set '''sendmail "-t"''' on Windows, it's not there, so what do you think they do? Yep, write something useful, like “fake sendmail” by '''Byron Jones''', and give it to the community. The latest software “fake sendmail for windows” can be found here '''[http://glob.com.au/sendmail/ glob.com.au]'''


== Background ==
== Background ==
I like pictures it helps with thought processes, take the PHP mail function it has no preconceived idea what OS its running on. The one thing it knows, it must get rid of the data it is given. As long as the exchange is mutually acceptable it goes away happy.
I like pictures because it helps with the thought processes. Take the PHP mail function; it has no preconceived idea what OS it's running on. The one thing it knows is that it must get rid of the data it is given. As long as the exchange is mutually acceptable it goes away happy.


To get rid of its data, knocks on the '''php.ini''' door checks the door number, '''SMTP''', '''smtp_port''' and '''sendmail_from''' all filled in correctly and dumps the data, after getting a '''receipt''' proceeds on its merry way.
To get rid of its data, it knocks on the '''php.ini''' door, checks that the door number, '''SMTP''', '''smtp_port''' and '''sendmail_from''' are all filled in correctly and dumps the data. After getting a '''receipt''', it proceeds on its merry way.


Next day, knocks on the same php.ini door, hey no door number (SMTP, smtp_port and sendmail_from not filled in), new tenant tells him to try the gym, looks '''up sendmail_path''', its found data is taken a receipt issued, PHP mail is happy and again proceeds on its merry way.
Next day, it knocks on the same php.ini door. Hey! No door number (SMTP, smtp_port and sendmail_from not filled in), new tenant tells him to try the gym, looks up '''sendmail_path''';  data it's found is taken, a receipt issued and PHP mail is happy and again proceeds on its merry way.


The above really is to dispel some misconceptions about the php.ini file:
The above really is to dispel some misconceptions about the php.ini file:
Line 49: Line 49:
<nowiki>;</nowiki> mail.force_extra_paramaters =
<nowiki>;</nowiki> mail.force_extra_paramaters =
|
|
These are defaults settings for php.ini, at a first glance you would think there are two-separate sections one specific to Windows and the other for Unix, in reality '''they are two options''' you can use on Windows.
These are defaults settings for php.ini. At a first glance you would think there are two separate sections, one specific to Windows and the other for Unix, in reality '''they are two options''' that you can use on Windows.


'''1)''' If you known the name of an SMTP server and want the mail function to interact directly with it you can use this option and comment out the path section. {Covered on the previous page}
'''1)''' If you known the name of an SMTP server and want the mail function to interact directly with it you can use this option and comment out the path section. {Covered on the previous page}
Line 57: Line 57:
'''2)''' If you want another program to act as an intermediary between PHP and a SMTP server, comment out the SMTP section and state the path to the program you want to use.
'''2)''' If you want another program to act as an intermediary between PHP and a SMTP server, comment out the SMTP section and state the path to the program you want to use.


Its this option we use for linking '''Fake sendmail'''  
It's this option we use for linking '''Fake sendmail'''  
|}
|}


Line 93: Line 93:
With '''Fake Sendmail''' in place we need to edit the php.ini file so PHP’s mail function can use it.
With '''Fake Sendmail''' in place we need to edit the php.ini file so PHP’s mail function can use it.


Open the file '''php.ini''' located in folder '''*\Uniform Server\udrive\usr\local\php''' search for this section ['''mail function'''] (starts around line 612)
Open the file '''php.ini''' located in folder '''*\Uniform Server\udrive\usr\local\php''' and search for this section <nowiki>[</nowiki>'''mail function'''<nowiki>]</nowiki> (starts around line 612)


{|cellpadding="8"
{|cellpadding="8"
Line 127: Line 127:
The final part of the installation is to set-up '''sendmail.ini''' file located in folder '''*\Uniform Server\udrive\usr\local\sendmail'''
The final part of the installation is to set-up '''sendmail.ini''' file located in folder '''*\Uniform Server\udrive\usr\local\sendmail'''


Below I have listed three possible configurations the first is really a reference it does not use authentication and produces a similar result to the solution outlined on the previous page. To make it easier to read I have removed all comments.
Below I have listed three possible configurations. The first is really a reference; it does not use authentication and produces a similar result to the solution outlined on the previous page. To make it easier to read I have removed all comments.


{|cellpadding="4"
{|cellpadding="4"
Line 211: Line 211:
|}
|}


If you have problems uncomment the lines '''error_logfile''' and '''debug_logfile''' so you can trace what went wrong (Note: these files will be created in folder *\Uniform Server\udrive\usr\local\sendmail).
If you have problems, uncomment the lines '''error_logfile''' and '''debug_logfile''' so you can trace what went wrong (Note: these files will be created in folder *\Uniform Server\udrive\usr\local\sendmail).


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
Line 219: Line 219:
Start Uniform Server and type the following into your browser address bar: '''<nowiki>http://localhost/mail.html</nowiki>'''
Start Uniform Server and type the following into your browser address bar: '''<nowiki>http://localhost/mail.html</nowiki>'''


There is no need to enter any data into the text boxes just click on '''Send''' you will receive this message:
There is no need to enter any data into the text boxes. Just click on '''Send''' and you will receive this message:


* A page is displayed with the following message:
* A page is displayed with the following message:
* '''Thank you for sending email'''
* '''Thank you for sending email'''


Login to your mail account and check you received the message.
Login to your mail account and check if you received the message.


'''''Test'' 2:'''
'''''Test'' 2:'''


To check your ISP relays to other SMTP servers. Send an email to a friend or to another account you own, make sure your ISP hosts neither.
To check whether your ISP relays to other SMTP servers, send an email to a friend or to another account you own. Make sure your ISP hosts neither.


Run the test page (<nowiki>http://localhost/mail.html</nowiki>) this time you will need to fill in the text boxes.
Run the test page (<nowiki>http://localhost/mail.html</nowiki>). This time you will need to fill in the text boxes.
Confirm that the emails are received, that completes the tests.
Confirm that the emails are received. That completes the tests.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
== Problems ==
== Problems ==
In the real world things never run that smoothly something always throws a spanner in the works. If the above fails use this checklist to see it either resolves the problem or points to where the problem is:
In the real world things never run that smoothly. Something always throws a spanner in the works. If the above fails use this checklist to see if either resolves the problem or points to where the problem is:


# You need to be connected to the Internet (via your ISP) before running your PHP program.
# You need to be connected to the Internet (via your ISP) before running your PHP program.
Line 246: Line 246:
'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
== Conclusion ==
== Conclusion ==
I have shown two solutions to get you up and running with PHP’s mail function. The first is the easier of the two to implement however the second offers more power if you need portability and or authentication.
I have shown two solutions to get you up and running with PHP’s mail function. The first is the easier of the two to implement, however the second offers more power if you need portability and or authentication.


I like alternatives why not install hMailServer its worth a look, covered in this [[SSL Part 2: PHP mail function |new project]]. one minor drawback its not a portable solution.
I like alternatives. why not install hMailServer? It's worth a look, covered in this [[SSL Part 2: PHP mail function |new project]]. One minor drawback: it's not a portable solution.
   
   
'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''

Navigation menu