Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-26-2011, 02:06 AM   #1
LQ Newbie
Registered: Nov 2010
Posts: 25

Rep: Reputation: 0
mail() function in php

hey,my mail() function dsn't work ! i have configure the php.ini ;
<code>For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail

and the script is simple

$to = "";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "";
$headers = "From:" . $from;

echo "Mail Sent.";
{echo "fail";}

i got fail always ! anyHelp
Old 04-26-2011, 05:44 AM   #2
LQ Newbie
Registered: Jun 2009
Distribution: Debian GNU/Linux
Posts: 29

Rep: Reputation: 0
You need to have a valid SMTP server set in your PHP environment. Either your local one or the one that you intend to send your mail to can be used. The latter is preferable, i.e. Yahoo's mail server if you want your mails to be sent only to yahoo. But if you want to send your mails to any server, you have to setup a valid SMTP server on your machine.
Old 04-27-2011, 01:59 PM   #3
LQ Newbie
Registered: Nov 2010
Posts: 25

Original Poster
Rep: Reputation: 0
actually i did every thing ,how i should validate SMTP server ?? i have downloaded postfix and did every thing ,when i sent email (from the localhost) i got nothing in hotmail or yahoo of gmail !
Old 04-29-2011, 03:00 AM   #4
LQ Newbie
Registered: Apr 2011
Posts: 3

Rep: Reputation: 0
Hey,buddy,i run into the same problem you faced, it seems php main() function doesn't work at all,i tried the same as you did
But when i'm using zend_mail, a component of zend framework, it works nice! My suggestion to you is go and look up zend_mail in detail, it might explain the whole thing.
Old 04-29-2011, 03:03 AM   #5
LQ Newbie
Registered: Apr 2011
Posts: 3

Rep: Reputation: 0
BTW, does any of worked with DMdelivery before? i got a problem with it for days. can you contact me if you have experienced with DMdelivery?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Mail function phantom_cyph Programming 6 05-16-2008 12:45 AM
mail-function php sharp81 Linux - Software 3 02-17-2006 10:45 AM
HELP !!! php mail function akamaru607 Programming 22 08-26-2005 03:44 PM
PHP - mail function saravanan1979 Programming 2 08-06-2003 02:46 AM
Using the PHP mail() Function !?!? Hdata Programming 0 06-22-2003 07:02 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:15 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration