Page 1 of 1

Set php.ini for sending mail

Posted: Tue Sep 16, 2008 4:20 pm
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?

Re: Set php.ini for sending mail

Posted: Wed Sep 17, 2008 1:45 pm
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!

Re: Set php.ini for sending mail

Posted: Wed Sep 17, 2008 2:06 pm
by nikpony
My friend this ain't a solution.Somebody else who knows about it?Help pls help...i am going to disappoint.

Re: Set php.ini for sending mail

Posted: Wed Sep 17, 2008 3:13 pm
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...

Re: Set php.ini for sending mail

Posted: Wed Sep 17, 2008 3:45 pm
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!

Re: Set php.ini for sending mail

Posted: Wed Sep 17, 2008 4:47 pm
by nikpony
VladSun i 've did it a lot of times but nothing...

Re: Set php.ini for sending mail

Posted: Wed Sep 17, 2008 5:08 pm
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

Re: Set php.ini for sending mail

Posted: Thu Sep 18, 2008 6:05 am
by nikpony
THANK YOU THANK YOU THANK YOU!YOU SOLVE ME.