wo, another question on emailing in PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
johnsonzhang
Forum Newbie
Posts: 3
Joined: Sun Apr 06, 2003 5:33 am
Contact:

wo, another question on emailing in PHP

Post by johnsonzhang »

I've tried it out last time. but the server replied to me an error message
like "call to undefined function" when i attempt to use email() function in it. who can tell me why :cry:
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

There is a mail() function but not an email() function built into PHP - perhaps this is the problem.

Mac
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

hehe, unless you do something like this:

Code: Select all

<?php
function email ($to, $subject, $messege, $headers){
if(mail($to, $subject, $message,$headers)) {
echo "Mail Sent"; 
} else { 
echo "Mail Not Sent" ; 
} 
}
?>
:wink:
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Oromian wrote:hehe, unless you do something like this:
Well that's not actually a function built in to PHP - it's a user-defined function. Since the error received is call to undefined function it could be that there has just been a spelling mistake - if there already was a defined function called email() then the error wouldn't happen would it?

Mac
Post Reply