bkkranj Posted December 15, 2007 Share Posted December 15, 2007 Posting from web form returns: Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in G:\WWW\Testna\mail.php on line 8 and my mail.php looks like: <?php $to = "bowlingklubkranj@gmail.com"; $user = $_REQUEST["user"]; $email = $_REQUEST["email"]; $comments = $_REQUEST["comments"]; $headers = "From: $email"; mail($to, $comments, $headers); echo "Hvala za sporocilo."; ?> Could anyone pls help me? You can look at my www: http://bkkranj.no-ip.info (form on right side) Tnx Quote Link to comment Share on other sites More sharing options...
mrdamien Posted December 15, 2007 Share Posted December 15, 2007 Try this: <?php $to = "bowlingklubkranj@gmail.com"; $user = $_POST["user"]; $email = $_POST["email"]; $comments = $_POST["comments"]; $headers = "From: $email"; mail($to, $comments, $headers); echo "Hvala za sporocilo."; ?> $_REQUEST is something else... Quote Link to comment Share on other sites More sharing options...
bkkranj Posted December 15, 2007 Author Share Posted December 15, 2007 That doesn't do the trick. I get the same message. Should I alter php.ini instead? But that would probably solve just sending from my comp,or not? I am confused... I need an universal solution. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 15, 2007 Share Posted December 15, 2007 Try http://www.w3schools.com/php/php_mail.asp Quote Link to comment Share on other sites More sharing options...
bkkranj Posted December 15, 2007 Author Share Posted December 15, 2007 Nothing. Now i've tried with: <?php $to = "bowlingklubkranj@gmail.com"; $user = $_REQUEST["user"]; $email = $_REQUEST["email"]; $comments = $_REQUEST["comments"]; $headers = "From: $email"; mail($to, $comments, $headers, "From: $email"); echo "Hvala za sporocilo."; ?> and i get the message: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in G:\WWW\mail.php on line 9 problem seems to be with line 9 ( mail($to, $comments, $headers, "From: $email"); ) :'( Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 15, 2007 Share Posted December 15, 2007 lol, you need to setup your php config files in order for this to work. I don't think you can send EMAILS, from localhost though. Quote Link to comment Share on other sites More sharing options...
bkkranj Posted December 15, 2007 Author Share Posted December 15, 2007 could you please direct me to solution i am completely new at this : :-\ if i adjust settings in php.ini, that would probably be a solution just 4 me, wouldnt it? what about if someone else tries to post from my web form? im getting dizzy. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 15, 2007 Share Posted December 15, 2007 could you please direct me to solution i am completely new at this : :-\ Well, I guess you don't have a SMTP sever on your local, use your ISP's SMTP in your php.ini file Quote Link to comment Share on other sites More sharing options...
bkkranj Posted December 15, 2007 Author Share Posted December 15, 2007 i guess i would have to change this in php.ini: [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 ; For Win32 only. ;sendmail_from = me@example.com What about password. I an ussing gmail. is it required? Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 15, 2007 Share Posted December 15, 2007 You should be fine without it/ Quote Link to comment Share on other sites More sharing options...
bkkranj Posted December 15, 2007 Author Share Posted December 15, 2007 You should be fine without it/ what about visitors? does this applies to them also? i dont se a connection. should i install mail server? Quote Link to comment Share on other sites More sharing options...
Lamez Posted December 15, 2007 Share Posted December 15, 2007 well if you have it on your computer or your web server, and this is your only source of getting on the net, then you need to set it up a mailserver, but if you have web hosting then they have a mail server. Quote Link to comment Share on other sites More sharing options...
bkkranj Posted December 15, 2007 Author Share Posted December 15, 2007 no, it's my comp. if i set mailserver would that mean that all posting would be directed through it? also from external users? or does the posting depend from one's specific settings? Quote Link to comment Share on other sites More sharing options...
bkkranj Posted December 15, 2007 Author Share Posted December 15, 2007 i've tried to use gmail smtp in php.ini: [mail function] ; For Win32 only. SMTP = smtp.gmail.com smtp_port = 587 it returns: Warning: mail() [function.mail]: SMTP server response: 530 5.7.0 Must issue a STARTTLS command first e8sm7643806muf in G:\WWW\mail.php on line 9 ????? Quote Link to comment Share on other sites More sharing options...
marcus Posted December 15, 2007 Share Posted December 15, 2007 mail(to,subject,message,headers); Quote Link to comment Share on other sites More sharing options...
bkkranj Posted December 15, 2007 Author Share Posted December 15, 2007 to short 4 me. i need details. thx in advance Quote Link to comment Share on other sites More sharing options...
bkkranj Posted December 15, 2007 Author Share Posted December 15, 2007 I've managed to install smtp server, and now i am receiving mails. IT'S JUST THAT THEY ARE EMPTY !!!! I'll lose it. How could this be happening. Quote Link to comment Share on other sites More sharing options...
bkkranj Posted December 15, 2007 Author Share Posted December 15, 2007 Pls, need help. Quote Link to comment Share on other sites More sharing options...
mrdamien Posted December 16, 2007 Share Posted December 16, 2007 mgallforever pointed out your putting the mail() paramaters in the wrong way: mail(to,subject,message[,headers]); try <?php $to = "bowlingklubkranj@gmail.com"; $user = $_POST["user"]; $email = $_POST["email"]; $comments = $_POST["comments"]; $subject= "From: $email"; mail($to, $subject, $comments); echo "Hvala za sporocilo."; ?> Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 16, 2007 Share Posted December 16, 2007 mgallforever pointed out your putting the mail() paramaters in the wrong way: mail(to,subject,message[,headers]); try <?php $to = "bowlingklubkranj@gmail.com"; $user = $_POST["user"]; $email = $_POST["email"]; $comments = $_POST["comments"]; $subject= "From: $email"; mail($to, $subject, $comments); echo "Hvala za sporocilo."; ?> Your forgetting headers $from = $_POST['from']; $headers = "from $from"; Quote Link to comment Share on other sites More sharing options...
mrdamien Posted December 16, 2007 Share Posted December 16, 2007 Headers are optional bool mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameters ]] ) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.