-2
我希望你能幫助我解決我的問題,因爲我真的需要我的網站。 如何添加將文件附加到我用PHP編寫的在線電子郵件的可能性? :)如何將附件添加到我的在線電子郵件PHP?
這裏是我想將它添加到代碼:
<?php
session_start();
if(isset($_POST['submit']))
{
if($_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code']))
{
$to=$_POST["to"];
$from=$_POST["from"];
$name=$_POST["name"];
$subject=$_POST["subject"];
$message=$_POST["message"];
$message=$message."\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
$head="From: ".$from."\r\n".'Reply-To: '.$From."\r\n";
$her=$head.' < '.$from.' >';
$techomag=mail($to, $subject, $message, $her);
echo "Your Message Has been send successfully...:)..";
unset($_SESSION['security_code']);
echo('<a href="mysite.com/index.php">Click here to send another email</a>');
}
else
{
echo 'Sorry, you have provided an invalid captcha security code :(...';
echo('<a href="mysite.com/index.php">Click here to Go back and try once more</a>');
}
}
else
{
?>
<?php
?>
<div style="height:10px; clear:both"></div>
<form action="index.php" method="post">
<table border="1"><tbody>
<tr><td>To Email :</td><td><input name="to" type="text" /></td></tr>
<tr><td>From Email :</td><td><input name="from" type="text" /></td></tr>
<tr><td>From Name :</td><td><input name="name" type="text" /></td></tr>
<tr><td>Subject :</td><td><input name="subject" type="text" /></td></tr>
<tr><td>Message :</td><td><textarea cols="30" rows="10" name="message"></textarea></td></tr>
<tr><td><img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" /><br />
<label for="security_code">Security Code: </label><input id="security_code" name="security_code" type="text" />
<input type="submit" name="submit" value="Send Email!" /></td></tr>
</tbody></table>
</form>
<?php
}
?>
可能的重複[如何添加在PHP的在線郵件上附加文件的能力?](http://stackoverflow.com/questions/20529650/how-do-i-add-the-ability-對附加-A-文件上-A-在線郵件功能於PHP) – vstm