Set php.ini for sending mail

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
nikpony
Forum Newbie
Posts: 8
Joined: Tue Sep 16, 2008 4:53 am

Set php.ini for sending mail

Post by nikpony »

Hello to all,this is my first message in your forum.
I am trying to find my error. I have set the php.ini with my custom settings(smtp,mail address)
i have did the same with the php5.ini,with the same file in the apache/bin folder, and i create this php file:

<? php
mail('mymail','The site Contact us','eee');
?>

and when i am trying to run it, i am seeing this:

Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\mail.php on line 2

If i write this:

<?
mail("my mail","test","Ok, it works");
?>

I will see this:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs\mail.php on line 2

Please if anybody wants may help me?
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Set php.ini for sending mail

Post by jaoudestudios »

Ditch windows and move to linux! Problem solve. No stupid remote mail server setup, linux takes care of it all. The mail function will just work out of the box!
nikpony
Forum Newbie
Posts: 8
Joined: Tue Sep 16, 2008 4:53 am

Re: Set php.ini for sending mail

Post by nikpony »

My friend this ain't a solution.Somebody else who knows about it?Help pls help...i am going to disappoint.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Set php.ini for sending mail

Post by VladSun »

jaoudestudios's advice is a good one ;)

Anyway... You have to configure your PHP - in php.ini you'll find:

Code: Select all

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
 
; For Win32 only.
sendmail_from = me@example.com
change'em to apropriate ones and restart Apache service...
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Set php.ini for sending mail

Post by jaoudestudios »

Thanks :)

I could never get WAMP working with a remote mailserver, or a local one for that matter. So I changed to LAMP a long while back and have not looked back since!
nikpony
Forum Newbie
Posts: 8
Joined: Tue Sep 16, 2008 4:53 am

Re: Set php.ini for sending mail

Post by nikpony »

VladSun i 've did it a lot of times but nothing...
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Set php.ini for sending mail

Post by VladSun »

nikpony wrote:VladSun i 've did it a lot of times but nothing...
Create a file in you www directory, containing:

Code: Select all

<?php phpinfo(); ?>
browse to it and see what is the path to php.ini you are really using. Then edit this file, save it and restart Apache.

BTW: There should be no ";" in front of

Code: Select all

SMTP = put_your_smtp_server_here
smtp_port = 25
 
sendmail_from = some_user@your_domain.com
lines
There are 10 types of people in this world, those who understand binary and those who don't
nikpony
Forum Newbie
Posts: 8
Joined: Tue Sep 16, 2008 4:53 am

Re: Set php.ini for sending mail

Post by nikpony »

THANK YOU THANK YOU THANK YOU!YOU SOLVE ME.
Post Reply