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      = "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

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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

 

:'(

 

Link to comment
Share on other sites

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

 

?????

 

Link to comment
Share on other sites

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.";

?>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.