是我的编码不正确或什么是悬停和页脚的问题。我需要知道php邮件程序是正确的还是我有错误,我无法找到错误,因为邮件功能不工作在本地服务器。
<?php
if(isset($_POST["submit"])){
if($_POST["name"]==""||$_POST["email"]==""||$_POST["phone"]==""||$_POST["msg"]==""){
echo "Fill All Fields..";
}
else
{
$email=$_POST['email'];
$email= filter_var($email, FILTER_VALIDATE_EMAIL);
if (!$email){
echo "Invalid Sender's Email";
}
else{
$subject = $_POST['sub'];
$message = $_POST['msg'];
$headers = 'From:'. $email2 . "'r'n";
$headers .= 'Cc:'. $email2 . "'r'n";
$message = wordwrap($message, 70);
mail("recievers@gmail.com", $subject, $message, $headers);
echo "Your mail has been sent successfuly!";
}
}
}
?>
#wrapper
{
width:100%;
height:auto;
margin:0px;
background-color:orange;
}
#navbar
{
height:60px;
width:100%;
background-color:black;
color:white;
float:left;
}
ul li
{
display: block;
position: relative;
padding:20px 20px;
float:left;
}
ul li a
{
color:white;
}
#navbar a:hover
{
color:red;
padding:5px;
}
.carousel-inner > .item > img,
.carousel-inner > .item > a > img
{
width: 70%;
height:15%;
margin: auto;
background-color:white;
}
.thumbnail
{
height:300px;
width:300px;
padding:25px auto;
margin:5px;
}
.contact
{
width:60%;
height:300px;
background-color:grey;
padding:100px 25px;
float:left;
}
.enquiry
{
width:40%;
height:300px;
background-color:seagreen;
float:left;
padding-left:5px;
}
input[type=text]:focus {
border: 3px solid red;
}
input[type="text"]
{
margin: 0 0 15px 0;
}
.footer
{
height:60px;
width:100%;
background-color:black;
padding:10px;
color:white;
float:left;
}
.footer img
{
float:right;
margin:5px;
padding:5px;
}
<!doctype html>
<html>
<head>
<title>student</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div id="wrapper"><!--start wrapper-->
<div id="navbar"><!--start nav-->
<ul>
<li><a href="home.html">Home</li>
<li><a href="about.html">About us</li>
<li><a href="services.html">Services</li>
<li><a href="products.html">Products</li>
<li><a href="contact.html">Contact us</li>
</ul>
</div><!--end nav-->
<div id="myCarousel" class="carousel slide" data-ride="carousel"><!--carasel start-->
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
<li data-target="#myCarousel" data-slide-to="4"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="D:'task'photo'h.jpg" alt="Home" height="400px">
<div class="carousel-caption">
<h3>Home</h3>
</div>
</div>
<div class="item">
<img src="D:'task'photo'as.jpg" alt="About us" height="400px">
<div class="carousel-caption">
<h3>About us</h3>
</div>
</div>
<div class="item">
<img src="D:'task'photo's.jpg" alt="Services" height="400px">
<div class="carousel-caption">
<h3>Services</h3>
</div>
</div>
<div class="item">
<img src="D:'task'photo'p.jpg" alt="Products" height="400px">
<div class="carousel-caption">
<h3>products</h3>
</div>
</div>
<div class="item">
<img src="D:'task'photo'c.jpg" alt="Contact us" height="400px">
<div class="carousel-caption">
<h3>Contact us</h3>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div><!--end carosel-->
<div class="container-fluid text-center bg-grey"><!--boxes-->
<div class="row text-center">
<div class="col-sm-4">
<div class="thumbnail">
<img src="D:'task'photo'i.jpg" alt="Innovation">
<p><strong>Innovation</strong></p>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="D:'task'photo'cr.png" alt="Creative">
<p><strong>Creativity</strong></p>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="D:'task'photo'po.jpg" alt="Positive">
<p><strong>Positivity</strong></p>
</div>
</div>
</div><!--end boxes-->
<div id="con">
<div class="contact">
<h1>Address</h1>
<p><span class="glyphicon glyphicon-map-marker"></span>
Abc private limited
no54,2ndstreet,
madipakkam,
chennai-67.
</p>
<p><span class="glyphicon glyphicon-envelope"></span> ABCPVT@gmail.com</p>
</div>
<div class="enquiry">
<h1>Enquiry Form</h1>
<table border="0" align="center">
<form name="form" action="email.php" id="form" method="post">
<tr>
<tr>
<td>Name</td>
<td><input name="name" placeholder="Name" type="text" value=""></td>
</tr>
<tr>
<td>Email</td>
<td><input name="email" placeholder="Email" type="text" value=""></td>
</tr>
<tr>
<td>Phone</td>
<td><input name="phone" placeholder="phonenumber" type="text" value=""></td>
</tr>
<tr>
<td>Message</td>
<td><textarea name="msg" placeholder="Type your text here..."></textarea></td>
</tr>
<td colspan="2" style="text-align:center"><input id="send" name="submit" type="submit" value="Submit"></td>
</tr>
</form>
</table>
</div>
</div>
<div class="footer">
copyrights © to WWW.abcpvt.com
<img src="E:'photos'fb.png" alt="fb"/>
<img src="E:'photos'ln.png" alt="tweet"/>
<img src="E:'photos'tw.png" alt="linkedin"/>
</div>
</div><!--end wrapper-->
</body>
</html>
您可以使用sendmail包从本地主机发送邮件,sendmail包是XAMPP内置的。因此,如果您正在使用XAMPP,那么您可以轻松地从本地主机发送邮件。
例如,您可以配置C:'xampp'php'php.ini
和c:'xampp'sendmail'sendmail.ini
为gmail发送邮件。
在C:'xampp'php'php.ini中找到extension=php_openssl.dll并删除该行开头的分号以使SSL适用于gmail for localhost
在php.ini文件中找到[mail function]并修改
SMTP=smtp.gmail.com
smtp_port=587
sendmail_from = my-gmail-id@gmail.com
sendmail_path = "'"C:'xampp'sendmail'sendmail.exe'" -t"
现在打开C:'xampp'sendmail'sendmail.ini。将sendmail.ini中的所有现有代码替换为以下代码
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=my-gmail-id@gmail.com
auth_password=my-gmail-password
force_sender=my-gmail-id@gmail.com
现在你已经完成了!!创建带有邮件功能的PHP文件,从本地主机发送邮件。
PS:不要忘记替换上面代码中的my-gmail-id和my-gmail-password。另外,如果从上面复制设置,不要忘记删除重复的键。例如,如果有另一个sendmail_path:
,请在行后面注释php.ini文件sendmail_"路径= " C: ' xampp ' mailtodisk ' mailtodisk.exe "
还要记住使用XAMMP控制面板重新启动服务器,以便更改生效。
或
XMail或hMailServer可以做到这一点。
或
尝试PHPMailer
悬停不工作
- 这是因为carousel-inner是溢出在您的
#navbar
div,所以使用overflow: hidden;
-
页脚不占用100%!!因为footer是
#wrapper
的子类,所以100%只取父(#wrapper)宽度。因此,使用vw
而不是%
和计算margin-left属性将解决您的问题#navbar { height:60px; width:100%; background-color:black; color:white; overflow: hidden; } .footer { height:60px; width: 100vw; margin-left: calc(-51vw + 50%); background-color:black; padding:10px; color:white; position: fixed; bottom: 0; } #con { margin-bottom: 23vw; }
页脚的原因不是100%。
- 是100%的,但在加入
padding:10px;
后,它变得超过100%。要解决这个问题,你必须做出选择。要么你使用width:100%;
而不添加padding
,要么你添加padding
并使用display:block;
而不是width:100%;
- 其次,
box
缺少闭合div
。
<div class="container-fluid text-center bg-grey"><!--boxes-->
<div class="row text-center">
<div class="col-sm-4">
<div class="thumbnail">
<img src="D:'task'photo'i.jpg" alt="Innovation">
<p><strong>Innovation</strong></p>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="D:'task'photo'cr.png" alt="Creative">
<p><strong>Creativity</strong></p>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="D:'task'photo'po.jpg" alt="Positive">
<p><strong>Positivity</strong></p>
</div>
</div>
</div><!--end boxes-->
代替:
<div class="container-fluid text-center bg-grey"><!--boxes-->
<div class="row text-center">
<div class="col-sm-4">
<div class="thumbnail">
<img src="D:'task'photo'i.jpg" alt="Innovation">
<p><strong>Innovation</strong></p>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="D:'task'photo'cr.png" alt="Creative">
<p><strong>Creativity</strong></p>
</div>
</div>
<div class="col-sm-4">
<div class="thumbnail">
<img src="D:'task'photo'po.jpg" alt="Positive">
<p><strong>Positivity</strong></p>
</div>
</div>
</div><!-- this is the missing closing div-->
</div><!--end boxes-->
- 最后。你必须把
float:left;
从页脚和使用clear:both;
代替。这样做你会发现你有更好的结果。