0

HTMLとPHPのフィードバックフォームを作成しようとしていますが、次のようなメールが届きます。

New contact form submission 
From:,, 
Email:,@email, 
,,

私のhtmlは:

<form method="POST" action="contactform.php">
    Name:<br/>
        <input type="text" name="name" />
        <br/><br/>
    EMail:<br/>
        <input type="text" name="email" />
        <br/><br/>
    Message: <br/>
        <textarea name"message" rows="10" cols="50" />
        </textarea><br/>
    <input type="submit" value="submit" />
</form>

私のphpは:

<?php
//converting veriables
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$recipient = 'nicholasparry@me.com'; 
$subject="Contact Form"; 
//creating message
$content = "New contact form submission \n From:,$name, \n Email:,@email, \n ,$message,"; 
//sending message
mail($recipient, $message, $content);
?>

誰かが何が悪いのか私を助けることができますか?

4

3 に答える 3

4

これは:

$content = "New contact form submission \n From: ".$name.",\n Email: ".$email.", \n Message: ".$message;

<textarea name="message" rows="10" cols="50"></textarea>
于 2012-09-20T08:02:18.807 に答える
0

SwiftmailerまたはPhpMailerの使用を開始すると、生活が楽になります...

Swiftmailerの例:

require_once 'lib/swift_required.php';
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('Wonderful Subject')
    ->setFrom(array('john@doe.com' => 'John Doe'))
    ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
    ->setBody('Here is the message itself');
$mailer->send($message);

PhpMailerの例:

$mail             = new PHPMailer(); // defaults to using php "mail()"
$mail->SetFrom('name@yourdomain.com', 'First Last');
$mail->AddReplyTo("name@yourdomain.com","First Last");
$mail->AddAddress("whoto@otherdomain.com", "John Doe");
$mail->Subject    = "PHPMailer Test Subject via mail(), basic";
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$mail->AddAttachment("images/phpmailer.gif");      // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}

私はSwiftmailerが好きですが、あなたはあなたに最良の選択を選択します;-)

于 2012-09-20T08:08:25.983 に答える
0

変数名を中括弧で囲みます。例:「From:、{$ name}、」

于 2012-09-20T08:21:51.433 に答える