-5

我已经创建了一个联系表单,我希望在单击提交按钮后将详细信息发送到我的收件箱。单击提交按钮会打开一个新的邮件页面(参见 getfreepack.org)。我被告知我需要一个 PHP 脚本。我从网上复制了一个,但不太清楚如何利用它来发挥我的优势。我会很感激你的帮助。

$Name= $_REQUEST["Name"]; 
$Email = $_REQUEST["Email"]; 
$Phone = $_REQUEST["Phone"]; 
$JobTitle = $_REQUEST["Jobtitle"]; 
$KeySkills = $_REQUEST["Keyskills"]; 
$Attachment = $_REQUEST["Attachment"]; 

$to = "my email address@mail.com"; 
$subject = "Contact Form"; 

$message = "Name: " . $Name $message .= "\Email: " . $Email: $message .= "\n Phone: " . $ Phone; 
$message .= "\nSubject: " . $Subject; $message .= "\nCover Letter: " . $CoverLetter; 
$message .= "\n Attachment: " . $Attachment; $message .= "\nIP Adress: " . $_SERVER['REMOTE_ADDR']; 
$message .= "\nBrowser: " . $_SERVER['HTTP_USER_AGENT']; 
$message .= "\n\nMessage: " . $theMessage; 

$headers = "From: $theEmail";
$headers .= "\nReply-To: $theEmail"; 

$sentOk = mail($to,$subject,$message,$headers); 
echo "sentOk=" . $sentOk;
4

2 回答 2

1

一个非常基本的方法是:

<?php
 $to = "someone@example.com";
 $subject = "Test mail";
 $message = "Hello! This is a simple email message.";
 $from = "someonelse@example.com";
 $headers = "From:" . $from;
 mail($to,$subject,$message,$headers);
 echo "Mail Sent.";
?> 

如果您想更进一步,请查看手册: http: //php.net/manual/en/function.mail.php

干杯

于 2013-07-04T12:44:49.447 回答
-1

您不需要 php 来获取要发送到您的电子邮件地址的表单,使表单标签如下所示:

>>action="mailto:youremailaddress@whatever.com"> 输入 输入

于 2013-07-04T12:53:04.117 回答