Jump to content

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
https://forums.phpfreaks.com/topic/81759-solved-problem-with-web-form/
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...

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

 

:'(

 

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 = "bowlingklubkranj@gmail.com";
$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 = "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";

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.