Jump to content

[SOLVED] Problem with web form


bkkranj

Recommended Posts

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      = "[email protected]";

$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

Link to comment
https://forums.phpfreaks.com/topic/81759-solved-problem-with-web-form/
Share on other sites

Try this:

<?php
$to      = "[email protected]";
$user = $_POST["user"];
$email = $_POST["email"];
$comments = $_POST["comments"];

$headers = "From: $email";
mail($to, $comments, $headers);
echo "Hvala za sporocilo.";

?>

$_REQUEST is something else...

Nothing. :(

 

Now i've tried with:

 

<?php

 

$to = "[email protected]";

$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"); )

 

:'(

 

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

 

?????

 

mgallforever pointed out your putting the mail() paramaters in the wrong way:

 

mail(to,subject,message[,headers]);

 

try

<?php
$to = "[email protected]";
$user = $_POST["user"];
$email = $_POST["email"];
$comments = $_POST["comments"];
$subject= "From: $email";

mail($to, $subject, $comments);
echo "Hvala za sporocilo.";

?>

mgallforever pointed out your putting the mail() paramaters in the wrong way:

 

mail(to,subject,message[,headers]);

 

try

<?php
$to = "[email protected]";
$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";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.