sending emails local host, XAMPP on Linux, php.ini

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

sending emails local host, XAMPP on Linux, php.ini

Postby luddite » 03. February 2013 15:03

I did quite a search yesterday of google on how to send emails from php scripts in htdocs of XAMPP on linux.

I have no problem sending emails using php scripts from my web site, but it would be nice to play with email scripts on my local PC, since basically I use xampp as a web development environment. My search yesterday using "linux" just brought up a lot of stuff on windows which mentioned using a google account to send mail.

such as php.ini

smtp= smtp.gmail.com
smtp_port =587
sendmail_from =mygmailaccount


then find sendmail.ini

What I want to confirm is that first in order to send emails from a php script in htdocs of xampp on linux , i frist need to install
postfix ?
luddite
 
Posts: 2
Joined: 03. February 2013 14:07
XAMPP Version: 5.6.3
Operating System: slackware14

Re: sending emails local host, XAMPP on Linux, php.ini

Postby JonB » 04. February 2013 07:54

As most Linux distributions come with sendmail, you should be able to use it for posting outbound mail.

I think in Fedora, its location is /usr/sbin/sendmail. I just checked one of my lampp installs with WordPress running. these settings are working correctly with lampp 1.7.7.
Sendmail is an SMTP MTA (Mail Transfer Agent - a forwarder) it will reliably send mail to external SMTP servers. I just tested using a Password Reset request that arrived in my Yahoo mailbox a few seconds later. :) I don't think I had to make any other changes when I set it up. It also worked with my YaBB forum testing.

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

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = On

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log =


http://en.wikipedia.org/wiki/Sendmail

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
XAMPP Version: 1.8.3-2
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: sending emails local host, XAMPP on Linux, php.ini

Postby luddite » 10. February 2013 13:27

I decided to first find what mail apps i have installed, use from the command line then assuming it worked ,invoke that app from
php.ini

bash-4.2# which mail
gives: /bin/mail

bash-4.2# which sendmail
gives: /usr/sbin/sendmail

I read up a bit,and got the hint that postfix might be easier, so installed that as well, its at
/usr/sbin/postfix

trying to send an email from the command line , I got a message in /var/spool/mail/andrew being :

----- The following addresses had permanent fatal errors -----
<myusername@gmail.com>
(reason: 550-5.7.1 [176.xxx.x.xx] The IP you're using to send mail is not authorized to)

----- Transcript of session follows -----
... while talking to gmail-smtp-in.l.google.com.:
>>> DATA
<<< 550-5.7.1 [176.xxx.x.xx]
The IP you're using to send mail is not authorized to
<<< 550-5.7.1 send email directly to our servers. Please use the SMTP relay at your
<<< 550-5.7.1 service provider instead. Learn more at
<<< 550 5.7.1 http://support.google.com/mail/bin/answer.py?answer=10336 r10si10195621wjx.198 - gsmtp
554 5.0.0 Service unavailable

So as far as I understand it, my Linux box sent an email directly to gmail, but gmail would prefer to go through my ISP ?

My ISP is sky.com and the smtp is : smtp.tools.sky.com so mu understanding is that if I want to send an email to myself
to my gmail email, from my box it has to go out via smtp.tools.sky.com.

I have seen some scripts that seem to define $smtpinfo, so am I right to leave
SMTP = localhost in the [mail function] of php.ini
//and
sendmail_path = usr/sbin/sendmail -t -l

and then specify smtp= smtp.tools.sky.com in my php mailer script?
luddite
 
Posts: 2
Joined: 03. February 2013 14:07
XAMPP Version: 5.6.3
Operating System: slackware14

Re: sending emails local host, XAMPP on Linux, php.ini

Postby JonB » 10. February 2013 19:07

In your case, you may need to use your ISP's STMP server as the forwarder. You may be able to send directly (without 'sendmail') provided you can authenticate with sky.com's SMTP server. This can likely be handled in php.ini, without sendmail. The best answers would come from form your ISP's FAQ or help desk.

OR configure sendmail to use sky.com's SMTP server (see option 2):

http://www.cyberciti.biz/faq/linux-conf ... ssion-mta/

I have never had to make these changes for my systems to work (and I have used more than one ISP with lampp), so I suspect you are making something more difficult that it needs to be. That example I gave you is from a working lampp install.

Good Luck
:)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
XAMPP Version: 1.8.3-2
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 6 guests