The Mother Board
Mail Function (linux) in PHP

 
Post new topic   Reply to topic    The Mother Board Forum Index -> Programming
View previous topic :: View next topic  
Author Message
Spark_Plug
Green Belt
Green Belt


Joined: 14 Jul 2004
Posts: 141

PostPosted: Sat Oct 02, 2004 5:40 pm    Post subject: Mail Function (linux) in PHP Reply with quote

I am trying to get the mail function to work I am getting this error: Fatal error: Call to undefined function mail() in /www/register.php on line 37
on line 37 I have this:
Code:
mail ($_POST['email'], 'Thank You for registering!', $body, 'From: ''.phorum_html_encode('abranaugh@gmail.com').''');


I know it has to do with my php.ini file so my quesiton is what shall i put into the php.ini file? I am using Linux by the way.

Thank You
Adam.
Back to top
View user's profile Send private message Send e-mail
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master


Joined: 16 Dec 2001
Posts: 13969
Location: Maine

PostPosted: Sat Oct 02, 2004 6:37 pm    Post subject: Reply with quote

Why do you have 2 double qoutes at the end of the line??? Having a single quote at the beginning and a double quote at the end will result in errors being displayed...
_________________
We Help You. You Can Help Us!
Read the rules prior to posting
Tell your newsgroup or mailing list
Link to us from your pages
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Spark_Plug
Green Belt
Green Belt


Joined: 14 Jul 2004
Posts: 141

PostPosted: Sat Oct 02, 2004 6:46 pm    Post subject: Reply with quote

I think the problem is that I just copied it from another forum where I posted the same message but don't get responces until days later, this is what is really on line 37
Code:
mail ($_POST['email'], 'Thank You for registering!', $body, 'From: abranaugh@gmail.com');


By the way I am using PHP 5 with Apache2.
Back to top
View user's profile Send private message Send e-mail
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master


Joined: 16 Dec 2001
Posts: 13969
Location: Maine

PostPosted: Sat Oct 02, 2004 6:59 pm    Post subject: Reply with quote

I'll direct MoboCop to this thread. He knows PHP a lot better then I do.
_________________
We Help You. You Can Help Us!
Read the rules prior to posting
Tell your newsgroup or mailing list
Link to us from your pages
Back to top
View user's profile Send private message Send e-mail Visit poster's website
MoboCop
Drunken Master


Joined: 18 Jan 2000
Posts: 8854
Location: Fresno

PostPosted: Sat Oct 02, 2004 11:00 pm    Post subject: Reply with quote

strange message mail() is a php function. Not sure how it cannot be defined.
_________________
Not everything that can be counted counts, and not everything that counts can be counted - Albert Einstien
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master


Joined: 16 Dec 2001
Posts: 13969
Location: Maine

PostPosted: Sat Oct 02, 2004 11:11 pm    Post subject: Reply with quote

MoboCop wrote:
strange message mail() is a php function. Not sure how it cannot be defined.
to have it defined you have to have quotes, brackets, etc. in the correct place and the correct type, correct?
_________________
We Help You. You Can Help Us!
Read the rules prior to posting
Tell your newsgroup or mailing list
Link to us from your pages
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Spark_Plug
Green Belt
Green Belt


Joined: 14 Jul 2004
Posts: 141

PostPosted: Sun Oct 03, 2004 6:23 am    Post subject: Reply with quote

I think the reason its not working is because I don't have sendmail set up, I downloaded it from sendmail.org. I don't understand the readme file and how to install it, could someone held me please?

EDIT: Got it installed, should i just leave the php.ini file under sendmail_path blank? what should I put in it?

Don't get the error message anymore, doesnt' send the email though.
Back to top
View user's profile Send private message Send e-mail
Spark_Plug
Green Belt
Green Belt


Joined: 14 Jul 2004
Posts: 141

PostPosted: Sun Oct 03, 2004 3:19 pm    Post subject: Reply with quote

Ok, I am trying it with Kmail now, I can send out of kmail with going to compose but still not sending me any email when I run the script. Here is my php.ini file of the mail function:
Code:
[mail function]
; For Win32 only.
SMTP = smtp.charter.net
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 =
sendmail_path = /usr/bin/kmail -t -i
sendmail_from = abranaugh@gmail.com
; 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 =
Back to top
View user's profile Send private message Send e-mail
MoboCop
Drunken Master


Joined: 18 Jan 2000
Posts: 8854
Location: Fresno

PostPosted: Sun Oct 03, 2004 6:31 pm    Post subject: Reply with quote

the mail function is defined in php. If you call it wrong you will get missing parameter errors. If you put incorrect quotes you will get a parse errror.

I dont understand the mail() function not being defined. Unless it is perhaps turned off in php.ini? I dont even know if this is possible. Mail function has always worked for me straight out of the default installation.

what errors are you getting now?
_________________
Not everything that can be counted counts, and not everything that counts can be counted - Albert Einstien
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Spark_Plug
Green Belt
Green Belt


Joined: 14 Jul 2004
Posts: 141

PostPosted: Mon Oct 04, 2004 1:24 pm    Post subject: Reply with quote

MoboCop wrote:
the mail function is defined in php. If you call it wrong you will get missing parameter errors. If you put incorrect quotes you will get a parse errror.

I dont understand the mail() function not being defined. Unless it is perhaps turned off in php.ini? I dont even know if this is possible. Mail function has always worked for me straight out of the default installation.

what errors are you getting now?


none not sending the email thats all.
I found out kmail is like a outlook express so I have to use send mail.
Can soemone help me out and help me setup sendmail so that i can actually sendmail? When I try sendmail abranaugh@gmail.com
talkdsfal
<ctrl d>
I get the following error: collect: Cannot write ./dfi94LkS1n005864 (bfcommit, uid=1002, gid=251): Permission denied
queueup: cannot create queue file ./qfi94LkS1n005864, euid=1002: Permissiondenied
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The Mother Board Forum Index -> Programming All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group