通过php函数发送电子邮件? [英] Sending email through php function?
本文介绍了通过php函数发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个HTML代码
i have a html code
<form id="contact-form" action="sendemail.php" method="post" enctype="multipart/form-data">
<fieldset>
<label><span class="text-form">Your Name:</span><input type="text" name="name"></label>
<label><span class="text-form">Your Email:</span><input type="text" name="email"></label>
<div class="wrapper">
<div class="text-form">Your Message:</div>
<div class="extra-wrap">
<textarea name="msg"></textarea>
<div class="clear"></div>
<div class="buttons">
<span class="button-2">
<a önClick="document.getElementById('contact-form').reset()">clear</a>
</span>
<span class="button-3">
<a önClick="document.getElementById('contact-form').submit()">send</a>
</span>
</div>
</div>
</div>
</fieldset>
</form>
我有php功能通过我的网站发送电子邮件联系表格
sendemail.php
and i have php function to send an email through my website contact form
sendemail.php
<?php
if(isset($_POST['submit'])) {
$email = $_REQUEST['email'] ;
$msg = 'Name: ' .$_POST['name'] ."\n"
.'Email: ' .$_POST['email'] ."\n"
.'Comment: ' .$_POST['msg'];
$retval = mail( 'ruvininanayakkara@jspark.co','Feedback Form Results',$msg, "From: $email" );
if( $retval == true )
{
echo "<script type='text/javascript'>alert('submitted successfully!')</script>";
}
else
{
echo "<script type='text/javascript'>alert('failed!')</script>";
}
}
else{
exit(0);
}
?>
< br $> b $ b
那么如何将这两者结合起来才能取得成功?
so how can i combine these two to achieve a successful result?
推荐答案
_POST [' submit'])){
_POST['submit'])) {
email =
email =
_REQUEST [' < span class =code-string> email'];
_REQUEST['email'] ;
这篇关于通过php函数发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文