Page 1 of 1

Confused about sendmail, fake sendmail, php and sendmail

PostPosted: 01. June 2007 20:15
by Snoopy.pa30
I have done a few searches, but am getting more confused.

This is as much a HTML question as an XAMPP one, so please bear with me.

Here is my situation.

I have XAMPP installed, Apache, MySql, and FileZilla services running. Php seems to be working, but I am not really knowingly using it yet. Running on Windows XP desktop.

I have a VERY SIMPLE HTML form that I want to e-mail when a user hits the submit button.

I don't have Mercury Mail running, and would much prefer to leave it that way.

I have no idea what sendmail is, or the difference between sendmail and "fake" sendmail.

Can I use the "fake" sendmail to send the mail?? How?
I have edited the \sendmail\sendmail.ini and put in my ISP smtp and my userid and password.

Now how do I write the html Form command to use this "fake" sendmail.

Have I missed something basic? (very possible)
Is there a better (easier, faster, simpler) way?

Sorry for the basic question, but getting confused by all the search answers.

Thanks in advance for help and suggestions.

PostPosted: 02. June 2007 03:03
by Wiedmann
Have I missed something basic? (very possible)

I think so ;-)

A pure html form can't send a mail... But the target of the html form can be a PHP or Perl script, which send the mail (through sendmail).

e-mail from html form

PostPosted: 02. June 2007 16:16
by Snoopy.pa30

Thanks for the reply.

So, I set up the Action portion of the HTML Form to use a php script, like many of the ones found in the forums.

For my understanding, does the php mail() command use the /xampp/sendmail/sendmail.exe?

Is that what is considered the "fake" sendmail?

I now have it working, but would like to better understand what I have done and how it works, then I can help others!!


PostPosted: 02. June 2007 18:07
by Codesmith
senmail is a mail server that run on *nix.

(fake) sendmail included with the windows version of XAMPP pretends to be sendmail, but really just forwards the email, usually to your ISP's smtp server.

Mercury mail is if you want to setup a run a real mail server.

First you need to edit php.ini

Since I don't have Mercury mail or any other SMTP server running locally I comment out the smtp stuff.

Code: Select all
[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

Then you set the sendmail path, even though the php.ini says that this seting is for Unix Only. I also set a from address.

Even thought its in quotes, there is a bug that doesn't allow spaces in the senmail path. If there is a space in the path you can work around the bug by using the MS-DOS name for a folder (i.e progra~1 instead of program files).

Code: Select all
; For Win32 only.
sendmail_from = *****

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; !!BUG!! No spaces allowed even inside quotes.
sendmail_path = "C:\xampp162\sendmail\sendmail.exe -t"

Finally you need to configure sendmail.ini

This is what works for me (with my email address and password *** out).

I simply played with the settings until I got something that worked with my ISP's outgoing mail server.

Code: Select all

; you must change to your smtp server

; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify


; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging


; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging


; if your smtp server requires authentication, modify the following two lines


; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines


; to force the sender to always be the following email address, uncomment and
; populate with a valid email address.  this will only affect the "MAIL FROM"
; command, it won't modify the "From: " header of the message content


; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting.  you can manually set the ehlo/helo name if required


Unfortunately as far as I know this only works if your ISP's smtp server doesn't use any form of encryption.

Complete Information

PostPosted: 05. June 2007 19:54
by Snoopy.pa30
Thanks for the reply Codesmith.

My working solution is slightly different from yours, so hopefully it will give people an alternative to try.

For Completeness I like to summarize the solution.

HTML Form (one of my original mistakes)
<form name="contact" method="post" action="sendthemail.php">
****form details omitted - standard text items for Subject and Message*****

Modify the PHP.ini - xampp/apache/bin/php.ini *****there are MANY versions on my machine - make sure you modify the one that apache is using *****

in the Module Settings area
in the [mail function] section - like Codesmith showed

; For Win32 only.
SMTP = *****set for YOUR ISP *****
smtp_port=25 *****port 25 is default *****

; For Win32 only.
sendmail_from = *****set for YOUR Username and ISP *****

I did not change or uncomment the sendmail_path as Codesmith did.
Mine was already set properly to the xampp/sendmail/sendmail.exe directory location

Mine still shows
; For Unix only. ....snip....
;sendmail_path = "C:\myinstalldir\xampp\sendmail\sendmail.exe -t"
***** Note it is still commented out *****

Modify the Sendmail.ini - xampp/sendmail/sendmail.ini

; if your smtp server requires authentication, modify the following two lines

****Insert your appropriate values here ****

Make the php file - xampp/htdocs/sendthemail.php

$to = "";
$subject = $_POST['subject'];
$message = $_POST['message'];

mail($to, $subject, $message);

*****subject and message in the $_POST are from the Form ****

I know this might be overkill for many on the forum, but for the beginners like me, I hope this is helpful.

PostPosted: 07. June 2007 22:40
by Codesmith
Your configuration doesn't use sendmail at all.

Instead you are using PHP to connect to an SMTP server which doesn't require any special authentication.

My cable modem account used to be setup that way. I managed to accidentally send an email through their smtp server 18 months after I switched to DSL.

My Mistakes

PostPosted: 09. June 2007 14:01
by Snoopy.pa30

So the difference between yours and mine is (from what I can see) uncommenting out the sendmail path.

So, if that is the only difference, how does the php mail() function know what it is supposed to do?

Or is there something else I have missed as well? (could easily be).

Thanks for your help in this.

As you can see, I am STILL CONFUSED about this sendmail stuff....

PostPosted: 09. June 2007 18:23
by Codesmith
Because you should always be using one method or the other, not both.

You configured php to send email directly to a server. Works great unless the server requires authentication.

Fake sendmail is a program that pretends to be linux's sendmail, but really just forwards the mail to an SMTP server. It supports connecting with a name and a password.

Neither method works if your real SMTP server uses encryption. :(

PostPosted: 02. September 2007 23:22
by outlaw
I was searching for the simplest mailing solution for development purposes and this did the trick.

Kudos for the *gotcha with the space in the pathname to sendmail
I also encountered another error that I fixed by enabling the error logs:
Socket Error # 10053<EOL>Software caused connection abort.

The fix as suggested ( ) was to check my anti-virus, and now it works perfectly

Hope this helps anyone else in need of a Mailing solution aside from Mercury!

PostPosted: 05. September 2007 21:49
by jlhaslip
Thank You!

It works...