Page 1 of 1

How to get mail work on linux xampp? [Solved]

PostPosted: 15. November 2011 20:52
by wombathts
I have Fedora 14 and newest xampp. What i need to do, to get working mail() function in php? Everything i fount refers to windows version of xampp.

Re: How to get mail work on linux xampp?

PostPosted: 16. November 2011 16:12
by JonB
Hi wombathts -

Is the idea you wish to use sendmail on your local machine, or 'what'???

Thanks
8)

Re: How to get mail work on linux xampp?

PostPosted: 16. November 2011 17:28
by wombathts
I want to send a e-mail by mail() function in php. It works on my webhosting, but on my own pc, on xampp not.

Re: How to get mail work on linux xampp?

PostPosted: 16. November 2011 18:43
by JonB
"I know you want to use the php mail functions"

BUT - You missed my point entirely :shock:

Do you want to use 'sendmail' -- its a unix/linux utility program -- which will send unauthenticated mail via your ISP (if they allow) on port 25 or do you want to use an SMTP server????

8)




ysf

Re: How to get mail work on linux xampp?

PostPosted: 16. November 2011 19:36
by wombathts
Oh, sorry, my english is not best.

No difference to me how, just want to have computer independent function for sending e-mails, to be able to move my scripts between different computers without changing php code or passwords, logins, etc

Re: How to get mail work on linux xampp?

PostPosted: 17. November 2011 15:44
by JonB
No difference to me how, just want to have computer independent function for sending e-mails, to be able to move my scripts between different computers without changing php code or passwords, logins, etc


You will need to build code for that kind of functionality, as the available options will vary from machine to machine.

There are multiple approaches to this - but 'raw' mail_function changes are done in php.ini - which is not portable between machines. That is why I asked about 'sendmail' - which is found on most *nix machines.

Good Luck
8)

Re: How to get mail work on linux xampp?

PostPosted: 17. November 2011 17:24
by wombathts
But, on my webhosting this:

Code: Select all
mail('someone@somedomain.com', 'subject', 'message','From: webmaster@example.com');


just works, without anything else, i want to get this working on my pc too to be able to test chages locally, not on public server.

Re: How to get mail work on linux xampp?

PostPosted: 17. November 2011 17:58
by JonB
just works, without anything else, i want to get this working on my pc too to be able to test chages locally, not on public server.


That's because your hosting firm set up the php.ini and probably linked it to sendmail. YOU are now the 'hosting firm' Are you on a shared host or a VPS???

I'll give you more information about sendmail after I am off work.

Good Luck
8)

Re: How to get mail work on linux xampp?

PostPosted: 17. November 2011 23:12
by JonB
OK - I have tested this with phpBB on version 1.7.4

IF you have an open port 25 on your ISP circuit AND a linux installation that includes a correctly configured 'sendmail' - the mail_function setting in php.ini should require no changes.

i.e

Code: Select all
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25


So its like I said in my very first response - 'sendmail works'

Good Luck
8)


ytsf

Re: How to get mail work on linux xampp?

PostPosted: 18. November 2011 18:45
by wombathts
So, if mails send by mail() function are not delivered, that my isp is blocking sending e-mails? and on my pc everything is ok?

thanks anyway.

Re: How to get mail work on linux xampp?

PostPosted: 18. November 2011 21:15
by JonB
Frist look at the sendmail log, you will have to su or sudo - it belongs to 'root' usually

normally the mail log is:
/var/log/maillog

send some mails then see whats there -

from my test -
Code: Select all
Nov 17 16:27:19 localhost sendmail[1088]: starting daemon (8.14.5): SMTP+queueing@01:00:00
Nov 17 16:27:20 localhost sm-msp-queue[1135]: starting daemon (8.14.5): queueing@01:00:00
Nov 17 16:51:47 localhost sendmail[3029]: pAHLpkNx003029: from=nobody, size=1613, class=0, nrcpts=1, msgid=<956d7da0ef655a8d955c330b813168f5@70.88.58.12>, relay=nobody@localhost
Nov 17 16:51:47 localhost sendmail[3032]: pAHLplfU003032: from=<nobody@localhost.localdomain>, size=1706, class=0, nrcpts=1, msgid=<956d7da0ef655a8d955c330b813168f5@70.88.58.12>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Nov 17 16:51:47 localhost sendmail[3029]: pAHLpkNx003029: to==?UTF-8?B?YWRtaW4=?= <jonx@newt.com>, ctladdr=nobody (99/99), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=31613, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (pAHLplfU003032 Message accepted for delivery)
Nov 17 16:51:50 localhost sendmail[3034]: pAHLplfU003032: to=<jonx@newt.com>, ctladdr=<nobody@localhost.localdomain> (99/99), delay=00:00:03, xdelay=00:00:03, mailer=esmtp, pri=121706, relay=mx4.ij.net. [207.22.166.97], dsn=2.0.0, stat=Sent (message sent ok)
Nov 17 17:04:50 localhost sendmail[3368]: pAHM4oEu003368: from=nobody, size=1243, class=0, nrcpts=1, msgid=<1a5f1a9aa7b8a187582d39054d489fa0@70.88.58.12>, relay=nobody@localhost
Nov 17 17:04:50 localhost sendmail[3371]: pAHM4oHu003371: from=<nobody@localhost.localdomain>, size=1336, class=0, nrcpts=1, msgid=<1a5f1a9aa7b8a187582d39054d489fa0@70.88.58.12>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Nov 17 17:04:50 localhost sendmail[3368]: pAHM4oEu003368: to==?UTF-8?B?Sm9uQg==?= <jxxxxxxx@gmail.com>, ctladdr=nobody (99/99), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31243, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (pAHM4oHu003371 Message accepted for delivery)
Nov 17 17:04:51 localhost sendmail[3373]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-SHA, bits=128/128
Nov 17 17:04:52 localhost sendmail[3373]: pAHM4oHu003371: to=<jxxxxxxx@gmail.com>, ctladdr=<nobody@localhost.localdomain> (99/99), delay=00:00:02, xdelay=00:00:02, mailer=esmtp, pri=121336, relay=gmail-smtp-in.l.google.com. [74.125.45.27], dsn=2.0.0, stat=Sent (OK 1321567493 y10si1182615ane.177)
Nov 17 17:05:27 localhost sendmail[3383]: pAHM5RPV003383: from=nobody, size=1340, class=0, nrcpts=1, msgid=<756374e81eb6396e5efb88d4df971079@70.88.58.12>, relay=nobody@localhost
Nov 17 17:05:28 localhost sendmail[3386]: pAHM5RpZ003386: from=<nobody@localhost.localdomain>, size=1433, class=0, nrcpts=1, msgid=<756374e81eb6396e5efb88d4df971079@70.88.58.12>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Nov 17 17:05:28 localhost sendmail[3383]: pAHM5RPV003383: to==?UTF-8?B?Sm9uQg==?= <jxxxxxxx@gmail.com>, ctladdr=nobody (99/99), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=31340, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (pAHM5RpZ003386 Message accepted for delivery)
Nov 17 17:05:28 localhost sendmail[3388]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-SHA, bits=128/128
Nov 17 17:05:29 localhost sendmail[3388]: pAHM5RpZ003386: to=<jxxxxxxx@gmail.com>, ctladdr=<nobody@localhost.localdomain> (99/99), delay=00:00:02, xdelay=00:00:01, mailer=esmtp, pri=121433, relay=gmail-smtp-in.l.google.com. [74.125.45.26], dsn=2.0.0, stat=Sent (OK 1321567530 y15si14905945any.35)




"nobody" there refers to the default owner of the mail process, i believe

If nothing is going out - I would just send the help desk an e-mail - "do you block outbound port 25???"

Even if your ISP was to block outbound e-mails on port 25, as long as you had an e-mail account that has authenticated SMTP access on another port - you probably could get it to work, there would be some php.ini settings perhaps.


Good Luck
8)

Re: How to get mail work on linux xampp?

PostPosted: 18. November 2011 23:05
by wombathts
here is what is on log after i try to send mail:

Nov 18 22:56:38 GUGUmobile6555b sendmail[15967]: pAILucXj015967: from=nobody, size=121, class=0, nrcpts=1, msgid=<201111182156.pAILucXj015967@localhost.localdomain>, relay=nobody@localhost
Nov 18 22:56:38 GUGUmobile6555b sendmail[15972]: pAILucun015972: from=<nobody@localhost.localdomain>, size=358, class=0, nrcpts=1, msgid=<201111182156.pAILucXj015967@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=GUGUmobile6555b [127.0.0.1]
Nov 18 22:56:38 GUGUmobile6555b sendmail[15967]: pAILucXj015967: to=wiesiu.wombat@gmail.com, ctladdr=nobody (99/99), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30121, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (pAILucun015972 Message accepted for delivery)
Nov 18 22:56:38 GUGUmobile6555b sendmail[15974]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-SHA, bits=128/128
Nov 18 22:56:39 GUGUmobile6555b sendmail[15974]: pAILucun015972: to=<wiesiu.wombat@gmail.com>, ctladdr=<nobody@localhost.localdomain> (99/99), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120358, relay=gmail-smtp-in.l.google.com. [74.125.39.27], dsn=5.0.0, stat=Service unavailable
Nov 18 22:56:39 GUGUmobile6555b sendmail[15974]: pAILucun015972: pAILudun015974: DSN: Service unavailable
Nov 18 22:56:39 GUGUmobile6555b sendmail[15974]: pAILudun015974: to=root, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31611, dsn=2.0.0, stat=Sent


guys from my isp says that they are not blocking anything.

Re: How to get mail work on linux xampp?

PostPosted: 18. November 2011 23:56
by JonB
"Message accepted for delivery)" == sendmail is working -

"stat=Service unavailable" it tried to sendmail but could not connect.

" STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=RC4-SHA, bits=128/128" couldn't make a TLS connection.

So 'sendmail' things are working - its busy trying to send your mail - but you, your network or your connection have issues. the Linux PC (and XAMPP and sendmail) is doing its job - You don't have your server on a wi-fi link or mobile link do you??? (i'm think that's a yes)

Server should never, ever be installed on a wi-fi or mobile link, due to the intermittent nature of the connection.

Only you can sort stuff like that out -

Good Luck, and I'm glad its working. :D
8)