Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用phpmailer将信息从网站发送到gmail帐户_Php_Html_Phpmailer - Fatal编程技术网

使用phpmailer将信息从网站发送到gmail帐户

使用phpmailer将信息从网站发送到gmail帐户,php,html,phpmailer,Php,Html,Phpmailer,我下载了php mailer并添加了Contactformhandler.php文件,代码如下。但是我的网站上的留言服务并不好用。请帮帮我 我收到错误-(!)致命错误:在第4行的C:\wamp\www\carlmkkever.com\ContactFormHandler.php中找不到类“PHPMailer” 调用堆栈 时间记忆功能定位 1 0.0008 247024{main}()..\ContactFormHandler.php:0 Contactformhandler.php编码是- &l

我下载了php mailer并添加了Contactformhandler.php文件,代码如下。但是我的网站上的留言服务并不好用。请帮帮我

我收到错误-(!)致命错误:在第4行的C:\wamp\www\carlmkkever.com\ContactFormHandler.php中找不到类“PHPMailer” 调用堆栈

时间记忆功能定位 1 0.0008 247024{main}()..\ContactFormHandler.php:0

Contactformhandler.php编码是-

<?php
require("mails\phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->Port = "587";
$mail->SMTPAuth = true;
$mail->SMTPDebug = 2;
$mail->Username = "sahil.katia7@gmail.com";
$mail->Password = "password";

$mail->From = "sahil.katia7@gmail.com";
$mail->FromName = "admin";
$mail->AddReplyTo("sahil.katia7@gmail.com");
$mail->AddAddress("sahil.katia7@gmail.com");
$mail->IsHTML(true);
$mail->Subject = "Test message sent using the PHPMailer component";
$mail->Body = "This is a test message.";
if(!$mail->send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message has been sent successfully"; }
header('location:index.html');
?>

Htmlcontactformcoding-

<!---ContactFormSection-->
            <div class="row">
                <div class="col-lg-8">
                    <div class="boxed-grey">

                            <div class="row">
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <form action="ContactFormHandler.php" method="post">
                                        <label for="name">
                                            Name</label>
                                        <input type="text" class="form-control" id="name" placeholder="Enter name" required="required" />
                                    </div>
                                    <div class="form-group">
                                        <label for="email">
                                            Email Address</label>
                                        <div class="input-group">
                                 <span class="input-group-addon"><span class="glyphicon glyphicon-envelope"></span>
                                </span>
                                            <input type="email" class="form-control" id="email" placeholder="Enter email" required="required" /></div>
                                    </div>

                                </div>
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label for="name">
                                            Message</label>
                            <textarea name="message" id="message" class="form-control" rows="9" cols="25" required="required"
                                      placeholder="Message"></textarea>
                                    </div>
                                </div>

                                <div class="col-md-12">
                                    <button type="submit" class="btn btn-skin pull-right" id="btnContactUs">
                                        Send Message</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>

名称
电子邮件地址
消息
发送消息

PHP不理解Windows路径:

require("mails\phpmailer.php");
              ^---
这只是一个转义的
p
,对php来说没有任何意义,所以您实际上是在这样做

require("mailsphpmailer.php");
你被告知,这是不存在的

试一试


相反。注意,
/
..

错误消息对我来说似乎很清楚是的,我也很清楚。但是一切都很好如果一切都很好,你就不会犯错误-那么,嗯,我应该如何处理这个问题?我怀疑是一个作业问题,因为它与-做你自己的工作相同!您的代码基于一个过时的示例,您使用的是旧版本的PHPMailer,您没有阅读文档,您使用重定向隐藏调试输出。我没有什么同情心。
require("mails/phpmailer.php");