Mail Function (linux) in PHP

Discuss all aspects of programming here.

Moderator: The Mod Squad

Mail Function (linux) in PHP

Postby Spark_Plug » Sat Oct 02, 2004 5:40 pm

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: Select all
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.
Spark_Plug
Green Belt
Green Belt
 
Posts: 141
Joined: Wed Jul 14, 2004 12:51 pm

Postby Toby B. » Sat Oct 02, 2004 6:37 pm

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...
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby Spark_Plug » Sat Oct 02, 2004 6:46 pm

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: Select all
mail ($_POST['email'], 'Thank You for registering!', $body, 'From: abranaugh@gmail.com');


By the way I am using PHP 5 with Apache2.
Spark_Plug
Green Belt
Green Belt
 
Posts: 141
Joined: Wed Jul 14, 2004 12:51 pm

Postby Toby B. » Sat Oct 02, 2004 6:59 pm

I'll direct MoboCop to this thread. He knows PHP a lot better then I do.
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby MoboCop » Sat Oct 02, 2004 11:00 pm

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
MoboCop
Drunken Master
 
Posts: 8854
Joined: Tue Jan 18, 2000 1:01 am
Location: Fresno

Postby Toby B. » Sat Oct 02, 2004 11:11 pm

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?
Toby B.
Lead Mobo-fu Master
Lead Mobo-fu Master
 
Posts: 14277
Joined: Sun Dec 16, 2001 1:01 am
Location: Maine

Postby Spark_Plug » Sun Oct 03, 2004 6:23 am

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.
Spark_Plug
Green Belt
Green Belt
 
Posts: 141
Joined: Wed Jul 14, 2004 12:51 pm

Postby Spark_Plug » Sun Oct 03, 2004 3:19 pm

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: Select all
[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 =
Spark_Plug
Green Belt
Green Belt
 
Posts: 141
Joined: Wed Jul 14, 2004 12:51 pm

Postby MoboCop » Sun Oct 03, 2004 6:31 pm

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
MoboCop
Drunken Master
 
Posts: 8854
Joined: Tue Jan 18, 2000 1:01 am
Location: Fresno

Postby Spark_Plug » Mon Oct 04, 2004 1:24 pm

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
Spark_Plug
Green Belt
Green Belt
 
Posts: 141
Joined: Wed Jul 14, 2004 12:51 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest