943,673 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 1075
  • PHP RSS
Mar 14th, 2008
0

Set server settings...yes or no?

Expand Post »
Hello,

Quick question...For the email code in the PHP script to work, do I have to make any server settings? or make any accomodation for the type of server it is being run on? If so, then please guide me...

The application is located on a Linux server.
Similar Threads
Reputation Points: 48
Solved Threads: 1
Posting Pro
maydhyam is offline Offline
555 posts
since Feb 2008
Mar 14th, 2008
0

Re: Set server settings...yes or no?

Hi maydhyam,
if you use a professional hosting (someone has set up the server for you) you don't have to worry about anything. Just use mail().

If you're running your own server (e.g. development server) then you need to check php.ini section [mail function]. For Linux you have to verify that sendmail_path is correct.
Reputation Points: 27
Solved Threads: 16
Junior Poster
petr.pavel is offline Offline
116 posts
since Mar 2008
Mar 14th, 2008
0

Re: Set server settings...yes or no?

Ok, I'm not quite sure what to do...I found the php.ini file, and this is what it says:

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = me@example.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;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 =
Reputation Points: 48
Solved Threads: 1
Posting Pro
maydhyam is offline Offline
555 posts
since Feb 2008
Mar 14th, 2008
0

Re: Set server settings...yes or no?

That's it. You said you have a linux box so you have to locate sendmail - I assume that you have it installed. To find where your sendmail is run:
bash Syntax (Toggle Plain Text)
  1. locate sendmail
then uncomment the sendmail_path row and enter the full path incl. the switches. For example:
ini Syntax (Toggle Plain Text)
  1. sendmail_path = /usr/sbin/sendmail -t -i
That should do.

Just curious: are you able to send e-mails from the box using pine or mutt? PHP usually works with default settings just fine if sendmail isn't installed into some unusual location. What I mean is that you could in fact, be having a sendmail problem, not PHP configuration problem.
Reputation Points: 27
Solved Threads: 16
Junior Poster
petr.pavel is offline Offline
116 posts
since Mar 2008
Mar 14th, 2008
0

Re: Set server settings...yes or no?

Nevermind what I said do what Petr.Pavel says
Last edited by JRSofty; Mar 14th, 2008 at 12:22 pm.
Reputation Points: 16
Solved Threads: 10
Junior Poster in Training
JRSofty is offline Offline
68 posts
since Dec 2007
Mar 17th, 2008
0

Re: Set server settings...yes or no?

Hey,

Thank You Petr 'PePa' Pavel, it worked like a charm...
Thanks All..
Reputation Points: 48
Solved Threads: 1
Posting Pro
maydhyam is offline Offline
555 posts
since Feb 2008
Feb 16th, 2009
0

Same Problem

Hello,

I have a php form that will not send the email to the selected email address. I spoke to the host about switching the php.ini settings but it still is not working correctly. It is hosted on a linux platform. I need some help to get this working.

My code is correct. When I tested the form on my local server it sends to the correct address, but when its uploaded to the server the mail does not send. Any help would be appreciated
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jprahst32 is offline Offline
6 posts
since Feb 2009
Feb 16th, 2009
0

Re: Same Problem

Hi there,
since you don't have a control over the server there's nothing you can do to in order to make the default mail() function work.

To be really really sure create a file with just one line:
php Syntax (Toggle Plain Text)
  1. mail('your@address.com', 'this is a test', 'test body');

I have been sure so many times and yet I was proven wrong later. So it's best to make your tests as simple as possible.

If you get the test message when run on your dev box but not from the production server you should give this script to the hosting company and tell them to fix their setup.

If they tell you to screw yourself you'll have to work around it. Consider using some mail() replacement like the excellent XPertMailer:
http://xpertmailer.sourceforge.net/
You can switch it to use a direct SMTP connection instead of default mail() function. For that case you will need to know what's your hosting's SMTP server for outgoing connections. Or you will have to use some other SMTP server, likely with SMTP authentication turned on.

XPertMailer has one additional feature and that is to connect to SMTP server of the recipient domain. That way the e-mail is sent through different SMTP servers, no need to use your own SMTP server.

Petr
Reputation Points: 27
Solved Threads: 16
Junior Poster
petr.pavel is offline Offline
116 posts
since Mar 2008
Feb 16th, 2009
0

Re: Set server settings...yes or no?

Thanks for the help. Good idea
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jprahst32 is offline Offline
6 posts
since Feb 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: A problem with date and mysql query
Next Thread in PHP Forum Timeline: php form linux settings for php.ini





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC