Page 1 of 1

Any mail server (even simpliest one) available in XAMPP Lite

PostPosted: 20. November 2010 18:28
by trejder
Hi there everyone,

Is there any e-mail server, can be even simplest, smallest one, that can be used in XAMPP Lite?

I don't like the idea of moving from well know lite version to "big" one only to be able to use e-mail sending functions. And even more - I have done it at my work and had so many problems configuring or using included Mercury server that I would do this again (move Lite -> Full) at home only if it would last think I can do.

I'm using XAMPP Lite 1.7.3 on Windows as my development (localhost) environment. Page I'm developing will finally be hosted on Linux in production version and as far as I know there are no such problems there as nearly every Linux distro is preconfigured so Apache (and XAMPP even Lite version) are ready to send e-mails out-of-the box.

I saw a copy of sendmail insilde my Windows Lite 1.7.3 version of XAMPP and thought that it will also be able to send e-mail. But either it is not configured properly or I'm doing something wrong, because I get annoying "mail() function failed" and info to check if my e-mail server is properly configured. And I am a complete newbie (or even dumb) in the area of e-mail servers and sending therefore I have no bloody idea what to do to have that Mercury at work or that sendmail at home to work! :(

Thanks in advance for any help or idea here,
Trejder

Re: Any mail server (even simpliest one) available in XAMPP

PostPosted: 20. November 2010 19:07
by JonB
you just need to fix the sendmail.ini and - if you are using php - the mailfunction section of php.ini

there should be a sendmail.ini in the sendmail folder, look at the examples

Here's the working part from my sendmail.ini that sends mail via my ISP (with the isp name changed) on port 25, no authorization required

Code: Select all
#xyz
account XYZ
host smtp.xyz.net
from jonb@xyz.net
auth off

# Set a default account
account default : XYZ


and my php.ini mail function setting

Code: Select all
[mail function]
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"
mail.add_x_header = Off


You might need to change the path for sendmail.exe, if you have it on a USB stick - tou might want a Drive Letter assignment utility.

Good Luck
:shock:

Re: Any mail server (even simpliest one) available in XAMPP

PostPosted: 21. November 2010 00:17
by trejder
JonB wrote:Here's the working part from my sendmail.ini that sends mail via my ISP (with the isp name changed) on port 25, no authorization required

Off-topic at the beginning: There is still an ISP provider out there that allows sending e-mail without authorisation on 25th port? :) Wow, how do they avoid tons of SPAM then?

Back to topic. First thought: Wow, is this that simple? Boy, I'm dumb I haven't figured this out myself! :)

But on second thought it isn't that simple. I unfortunately hasn't got such a "good" ISP. Not only I have to use authorization but I'm also forced to send e-mails through SSL. Therefore I setup my sendmail this way:

Code: Select all
# tlen temporal
account Tlen
tls on
tls_certcheck off
host poczta.o2.pl
port 465
from lanch@localhost
auth on
user {login}
password {pass}

My sendmail config in php.ini turned out to be good and valid (wrong sendmail itself configuration caused problems). Therefore I only changed port to: smtp_port = 465, to force using SSL.

Unfortunately, no luck! :( I must be doing something wrong or missing something because after hanging on rounding circle for over a minute Firefox displayed an empty page and in sendmail.log I found one new line saying:

Code: Select all
Nov 21 00:01:11 host=poczta.o2.pl tls=on auth=on user={login} from=lanch@localhost recipients={recipient} [b]smtpstatus=501 smtpmsg='501 SSL error: this server requires use of SSL protocol'[/b] errormsg='cannot get initial OK message from server' exitcode=EX_PROTOCOL

Any idea where I should follow from this point?

JonB wrote:You might need to change the path for sendmail.exe, if you have it on a USB stick - tou might want a Drive Letter assignment utility

Another off-topic. What do you mean by "Drive Letter assignment utility", because I'm looking for something like that though for other reasons (networking, not USB-related).

Re: Any mail server (even simpliest one) available in XAMPP

PostPosted: 21. November 2010 01:06
by JonB
About ISP's on port 25 = its a true ISP, so all the traffic flows through their DSLAM, servers and routers - so not a problem - if it doesn't originate on one of their IP's - or if off their network, use a local domain in one of their DNS servers - it gets tossed (they have their own complete mailservices as well). I have some domains on their DNS.

About your sendmail.ini - send me a PM with the sendmail settings pasted in. I'll see if I can see what is wrong

The Drive Letter Assignment tool I was referring to is specifically for USB drives, so they always attach as the same letter. - sorry.

You also should search this forum on "sendmail.ini" TLS - I'm pretty sure people have solved TLS problems before. use quotes around sendmail.ini or else it parses sendmail + ini

Check this one from Nobbie - it helped me fix my sendmail the first time -

viewtopic.php?f=16&t=39649#p157913

:)

Re: Any mail server (even simpliest one) available in XAMPP

PostPosted: 21. November 2010 07:50
by trejder
JonB,

Thanks - I won't bother you on PM as I solved the problem...

JonB wrote:Check this one from Nobbie - it helped me fix my sendmail the first time -
viewtopic.php?f=16&t=39649#p157913

I took this one step-by-step, but found no difference in presented there sendmail.ini in comparision to mine. I've only commented out SMTP and port in my php.ini as someone pointed out that using both them and path to sendmail is a non-sense. But it should have any influence on my problem as in my situation, sendmail was properly invoked from PHP in only wasn't able to deliver message.

In my situation the problem was port. I configured sendmail to use port 465 as this is the one I have in my Thunderbird config (in outgoing mail servers section) and though that the same must be used for SSL in sendmail. But it turned out that even if I use 465 in Thunderbird, I have to use 587 in sendmail. Changing port to that solved my problem. At least partially.

I followed above mentioned post and basing on information there I set different from and user clauses in my sendmail.ini as it was said that it is being ignored by sendmail anyway and user is being used. This turned out to be not true, because with this configuration I got an error message saying:

Code: Select all
Nov 21 07:13:54 host=xxx tls=on auth=on user=xxx from=lanch@localhost recipients=xxx smtpstatus=554 smtpmsg='554 5.7.1 Sender address rejected' errormsg='envelope from address lanch@localhost not accepted by the server' exitcode=EX_DATAERR

So, it seems that sendmail IS RESPECTING differences between from and user and is not overwriting one over another. Changing from to a valid e-mail (though still different as used for user as I use there onlyaccount name part, not the whole e-mail address) solved the problem finally and I was able to send e-mails.

Thank you very much for help with this.

One more off-topic question: In the same time I had an error in my PHP code which caused script to run in endless loop and trying to send a whole bunch of e-mails (exact copy). Before correcting errors in sendmail.ini I always got empty page as a result. After correcting them but before correcting code I've got either message from PHP that maximum execution time of 60 seconds was exceeded (though message appeared always after about 2-3 minutes since executing malformed code) or a messagebox from Firefox saying that it detected that server is trying to perform an illegal redirect.

Is it normal that in first situation neither PHP nor Firefox were able to handle that script clash (endless loop) and after correcting mistakes in sendmail.ini they were? Or is it just and coincidence?

Cheers,
Trejder

Re: Any mail server (even simpliest one) available in XAMPP

PostPosted: 21. November 2010 08:18
by JonB
I'm glad you got the sendmail to work :D

Its always good to know what went wrong too, so thanks for telling us what happened, maybe it will help another.

As for your last question, as I write perfect code, that has never happened to me. :mrgreen: So I wouldn't know...

Altrea does a lot more PHP programming than I, and he might have a good answer.

8)