Confused about sendmail, fake sendmail, php and sendmail

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Confused about sendmail, fake sendmail, php and sendmail

Postby Snoopy.pa30 » 01. June 2007 20:15

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.
Snoopy

"Still trying to shoot down that Red Baron"
Snoopy.pa30
 
Posts: 31
Joined: 02. March 2007 00:38
Location: Great White North

Postby Wiedmann » 02. June 2007 03:03

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).
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

e-mail from html form

Postby Snoopy.pa30 » 02. June 2007 16:16

Wiedmann,

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!!

Thanks.
Snoopy

"Still trying to shoot down that Red Baron"
Snoopy.pa30
 
Posts: 31
Joined: 02. March 2007 00:38
Location: Great White North

Postby Codesmith » 02. June 2007 18:07

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 = *****@sbcglobal.net

; 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"
[/code]

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
[sendmail]

; you must change mail.mydomain.com to your smtp server

smtp_server=smtp.sbcglobal.net

; 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

;default_domain=local

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

error_logfile=error.log

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

debug_logfile=debug.log

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

auth_username=*****@sbcglobal.net
auth_password=*****

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

;pop3_server=
;pop3_username=
;pop3_password=

; 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

;force_sender=*****@sbcglobal.net

; 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

;hostname=localhost



Unfortunately as far as I know this only works if your ISP's smtp server doesn't use any form of encryption.
Codesmith
 
Posts: 101
Joined: 31. March 2007 21:11

Complete Information

Postby Snoopy.pa30 » 05. June 2007 19:54

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 = smtp.yourisp.com *****set for YOUR ISP *****
smtp_port=25 *****port 25 is default *****

; For Win32 only.
sendmail_from = username@yourisp.com *****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
auth_username=yoursuserid
auth_password=yourpassword

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

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

<?php
$to = "desiredemail@isp.com";
$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.
Snoopy

"Still trying to shoot down that Red Baron"
Snoopy.pa30
 
Posts: 31
Joined: 02. March 2007 00:38
Location: Great White North

Postby Codesmith » 07. June 2007 22:40

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.
Codesmith
 
Posts: 101
Joined: 31. March 2007 21:11

My Mistakes

Postby Snoopy.pa30 » 09. June 2007 14:01

Codesmith,

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....
Snoopy

"Still trying to shoot down that Red Baron"
Snoopy.pa30
 
Posts: 31
Joined: 02. March 2007 00:38
Location: Great White North

Postby Codesmith » 09. June 2007 18:23

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. :(
Codesmith
 
Posts: 101
Joined: 31. March 2007 21:11

Postby outlaw » 02. September 2007 23:22

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 ( http://glob.com.au/sendmail ) 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!
outlaw
 
Posts: 18
Joined: 08. June 2007 23:01

Postby jlhaslip » 05. September 2007 21:49

Thank You!

It works...
Thanks for letting me visit...
jlhaslip
 
Posts: 10
Joined: 02. November 2006 08:02
Location: BC, Canada
Operating System: Ubuntu 10.4


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 82 guests