php mail ...how?

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
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

php mail ...how?

Post by crazytopu »

Hi,

I tested the php mail function with my local server where i could change the php.ini file and it all worked well. But what if I want to use the function when my script will reside on a server where I have no access to the php.ini file?

What information do I have to add inside the script in this case and where?
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

You might be able to use ini_set().
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

allthough any web server with php support probably has builtin support for the mail function, because allmost and i said allmost all servers have a mail server
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

Post by crazytopu »

So, dull554, you mean I dont have to add any extra thing? It would be suffice if I just upload the script that uses mail function without being concerned about the server's php.ini configuration?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

just make sure the script can handle the mail function failing, maybe with some "debugging" help for the person installing it.
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

maybe do smoething llike this

Code: Select all

$mail = mail(blah blah blah);
if ($mail) {echo "mail sent";}
if (!$mail) {echo "mail not sent";}
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Have a read: [php_man]mail[/php_man]
Post Reply