• <tfoot id='mT26i'></tfoot>

          <bdo id='mT26i'></bdo><ul id='mT26i'></ul>

        <legend id='mT26i'><style id='mT26i'><dir id='mT26i'><q id='mT26i'></q></dir></style></legend>

      1. <small id='mT26i'></small><noframes id='mT26i'>

      2. <i id='mT26i'><tr id='mT26i'><dt id='mT26i'><q id='mT26i'><span id='mT26i'><b id='mT26i'><form id='mT26i'><ins id='mT26i'></ins><ul id='mT26i'></ul><sub id='mT26i'></sub></form><legend id='mT26i'></legend><bdo id='mT26i'><pre id='mT26i'><center id='mT26i'></center></pre></bdo></b><th id='mT26i'></th></span></q></dt></tr></i><div id='mT26i'><tfoot id='mT26i'></tfoot><dl id='mT26i'><fieldset id='mT26i'></fieldset></dl></div>

      3. 邮件.php &amp;SMTP 身份验证问题

        Mail.php amp; Smtp Authentication Issue(邮件.php amp;SMTP 身份验证问题)
        • <i id='A9kT0'><tr id='A9kT0'><dt id='A9kT0'><q id='A9kT0'><span id='A9kT0'><b id='A9kT0'><form id='A9kT0'><ins id='A9kT0'></ins><ul id='A9kT0'></ul><sub id='A9kT0'></sub></form><legend id='A9kT0'></legend><bdo id='A9kT0'><pre id='A9kT0'><center id='A9kT0'></center></pre></bdo></b><th id='A9kT0'></th></span></q></dt></tr></i><div id='A9kT0'><tfoot id='A9kT0'></tfoot><dl id='A9kT0'><fieldset id='A9kT0'></fieldset></dl></div>
          • <bdo id='A9kT0'></bdo><ul id='A9kT0'></ul>

                <tbody id='A9kT0'></tbody>

              <small id='A9kT0'></small><noframes id='A9kT0'>

                <tfoot id='A9kT0'></tfoot>
                1. <legend id='A9kT0'><style id='A9kT0'><dir id='A9kT0'><q id='A9kT0'></q></dir></style></legend>

                  本文介绍了邮件.php &amp;SMTP 身份验证问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直在尝试利用 jquery 可联系插件(在 google 上找到!)中的 mail.php 文件在我的网站上使用.尽管提供的脚本相当简单,但我在将其与主机的 SMTP 要求集成时遇到了问题.这是没有 SMTP 身份验证的原始脚本:

                  <p><strong>姓名:</strong>$name <br/><strong>电子邮件:</strong>$emailAddr <br/><strong>问题:</strong>$问题 </p><p><strong>消息:</strong>$comment </p><p><strong>发送IP:</strong>$_SERVER[REMOTE_ADDR]<br/><strong>发送方式:</strong>$_SERVER[HTTP_HOST]

                  </div>";//发送并检查消息状态$response = (mail('mymail@mymail.com', $subject, $contactMessage, $headers) ) ?成功":失败";$output = json_encode(array("response" => $response));header('content-type: application/json; charset=utf-8');回声($输出);?>

                  我尝试使用来自 Google 的建议并玩了几个小时.这是迄今为止基于我对 php 的零理解的最新版本.-__- (基于此:http://blog.geek4support.com/php-mail-script-with-smtp-authentication-how-to-send-mails-by-php-mail-script-using-smtp-authetication/)

                  <p><strong>姓名:</strong>$name <br/><strong>电子邮件:</strong>$emailAddr <br/><strong>问题:</strong>$问题 </p><p><strong>消息:</strong>$comment </p><p><strong>发送IP:</strong>$_SERVER[REMOTE_ADDR]<br/><strong>发送方式:</strong>$_SERVER[HTTP_HOST]

                  </div>";$smtp = Mail::factory('smtp',数组('主机' => $主机,'认证' =>真的,'用户名' =>$用户名,'密码' =>$密码));$response = ($smtp->send('mymail@mymail.com', $subject, $contactMessage, $headers)) ?成功":失败";$output = json_encode(array("response" => $response));header('content-type: application/json; charset=utf-8');回声($输出);?>

                  我实际上遇到了一些问题.我的主机不支持 PHPMailer :-(.只有带有 SMTP 的 PearMail.他们建议调整上面列出的代码并将我现有的代码与它合并.确切地说,在在线发布之前我一直在尝试做的事情.回到广场1、有什么想法吗?

                  评论,建议,任何东西都将不胜感激!:-)

                  解决方案

                  对于发送邮件,试试 PHPMailer,它已经过测试,每个人都在使用它,而且它可以正常工作.它还具有许多功能和配置选项.

                  最新版本是这个,至于发送使用带有 PHPMailer 的 SMTP 发送邮件,这就是您需要的所有代码

                  //POST 请求收到的数据$name = stripcslashes($_POST['name']);$emailAddr = stripcslashes($_POST['email']);$issue = stripcslashes($_POST['issue']);$comment = stripcslashes($_POST['message']);$subject = stripcslashes($_POST['subject']);//发送邮件$mail = 新 PHPMailer();$mail->IsSMTP();//告诉类使用 SMTP//SMTP 配置$mail->SMTPAuth = true;//启用 SMTP 认证$mail->Host = "我的主机";//SMTP 服务器$mail->用户名 = "你的用户名@gmail.com";$mail->Password = "你的密码";//$mail->端口 = 465;//如果您不想使用默认值,则可选$mail->From = "my@email.com";$mail->FromName = "我的名字";$mail->主题 = $主题;$mail->AltBody = "要查看邮件,请使用与 HTML 兼容的电子邮件查看器!";//可选,注释掉并测试$mail->MsgHTML($issue . "<br/><br/>" . $comment);//添加任意数量$mail->AddAddress($emailAddr, $name);//如果你想附加一个文件,它的相对路径//$mail->AddAttachment("images/phpmailer.gif");//依恋$响应=空;if(!$mail->Send()) {$response = "邮件错误:" .$mail->错误信息;} 别的 {$response = "消息已发送!";}$output = json_encode(array("response" => $response));header('content-type: application/json; charset=utf-8');回声($输出);

                  I've been trying to utilize a mail.php file from the jquery contactable plugin (found on google!) to use on my website. Although the script provided is fairly simple I'm running into issues with integrating it with my Host's SMTP requirement. Here is the original script without SMTP authentication:

                  <?php
                      // Assign contact info
                      $name = stripcslashes($_POST['name']);
                      $emailAddr = stripcslashes($_POST['email']);
                      $issue = stripcslashes($_POST['issue']);
                      $comment = stripcslashes($_POST['message']);
                      $subject = stripcslashes($_POST['subject']);    
                  
                      // Set headers
                      $headers  = 'MIME-Version: 1.0' . "
                  ";
                      $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
                  ";
                  
                      // Format message
                      $contactMessage =  
                      "<div>
                      <p><strong>Name:</strong> $name <br />
                      <strong>E-mail:</strong> $emailAddr <br />
                      <strong>Issue:</strong> $issue </p>
                  
                      <p><strong>Message:</strong> $comment </p>
                  
                      <p><strong>Sending IP:</strong> $_SERVER[REMOTE_ADDR]<br />
                      <strong>Sent via:</strong> $_SERVER[HTTP_HOST]</p>
                      </div>";
                  
                      // Send and check the message status
                      $response = (mail('mymail@mymail.com', $subject, $contactMessage, $headers) ) ? "success" : "failure" ;
                      $output = json_encode(array("response" => $response));
                  
                      header('content-type: application/json; charset=utf-8');
                      echo($output);
                  
                  ?>
                  

                  I've tried using suggestions from Google and played around with it for hours. Here is the latest version based on my nil-understanding of php thus far. -__- (Based on this: http://blog.geek4support.com/php-mail-script-with-smtp-authentication-how-to-send-mails-by-php-mail-script-using-smtp-authetication/)

                  <?php
                   require_once "Mail.php";
                  
                      // Assign contact info
                      $name = stripcslashes($_POST['name']);
                      $emailAddr = stripcslashes($_POST['email']);
                      $issue = stripcslashes($_POST['issue']);
                      $comment = stripcslashes($_POST['message']);
                      $subject = stripcslashes($_POST['subject']);    
                  
                  
                   $host = "mail.mywebsite.com";
                   $username = "mywebsitemail@mywebsiteaddress.com";
                   $password = "mymailpassword";
                  
                      // Set headers
                      $headers  = 'MIME-Version: 1.0' . "
                  ";
                      $headers .= 'Content-type: text/html; charset=iso-8859-1' . "
                  ";
                  
                      // Format message
                      $contactMessage =  
                      "<div>
                      <p><strong>Name:</strong> $name <br />
                      <strong>E-mail:</strong> $emailAddr <br />
                      <strong>Issue:</strong> $issue </p>
                  
                      <p><strong>Message:</strong> $comment </p>
                  
                      <p><strong>Sending IP:</strong> $_SERVER[REMOTE_ADDR]<br />
                      <strong>Sent via:</strong> $_SERVER[HTTP_HOST]</p>
                      </div>";
                  
                   $smtp = Mail::factory('smtp',
                     array ('host' => $host,
                       'auth' => true,
                       'username' => $username,
                       'password' => $password));
                  
                  
                   $response = ($smtp->send('mymail@mymail.com', $subject, $contactMessage, $headers))  ? "success": "failure";
                  $output = json_encode(array("response" => $response));  
                      header('content-type: application/json; charset=utf-8');
                      echo($output);
                  
                   ?>
                  

                  I've actually run into a bit of a problem. My host doesn't support PHPMailer :-(. Only PearMail with SMTP. They have suggested tweaking the code listed above and incorporating my existing one with it. Exactly, what I've been trying to do before posting this online. Back to square 1, any ideas?

                  Comments, suggestions, anything would be most appreciated! :-)

                  解决方案

                  For sending mails, try PHPMailer, it's tested, everybody uses it, and it just works. It also has a lot of features and configuration options.

                  The latest version is this one, as for sending mails using SMTP with PHPMailer this is all the code you need

                  // Data received from POST request
                  $name = stripcslashes($_POST['name']);
                  $emailAddr = stripcslashes($_POST['email']);
                  $issue = stripcslashes($_POST['issue']);
                  $comment = stripcslashes($_POST['message']);
                  $subject = stripcslashes($_POST['subject']);   
                  
                  // Send mail
                  $mail = new PHPMailer();
                  $mail->IsSMTP(); // telling the class to use SMTP
                  
                  // SMTP Configuration
                  $mail->SMTPAuth = true;                  // enable SMTP authentication
                  $mail->Host = "myhost"; // SMTP server
                  $mail->Username = "yourusername@gmail.com";
                  $mail->Password = "yourpassword";            
                  //$mail->Port = 465; // optional if you don't want to use the default 
                  
                  $mail->From = "my@email.com";
                  $mail->FromName = "My Name";
                  $mail->Subject = $subject;
                  $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
                  $mail->MsgHTML($issue . "<br /><br />" . $comment);
                  
                  // Add as many as you want
                  $mail->AddAddress($emailAddr, $name);
                  
                  // If you want to attach a file, relative path to it
                  //$mail->AddAttachment("images/phpmailer.gif");             // attachment
                  
                  $response= NULL;
                  if(!$mail->Send()) {
                      $response = "Mailer Error: " . $mail->ErrorInfo;
                  } else {
                      $response = "Message sent!";
                  }
                  
                  $output = json_encode(array("response" => $response));  
                  header('content-type: application/json; charset=utf-8');
                  echo($output);
                  

                  这篇关于邮件.php &amp;SMTP 身份验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  smtp gmail server php mailer not working(smtp gmail服务器php邮件程序不工作)
                  Email goes in spam when I send it via others SMTP server(当我通过其他 SMTP 服务器发送电子邮件时,电子邮件进入垃圾邮件)
                      <tbody id='yn115'></tbody>
                  • <i id='yn115'><tr id='yn115'><dt id='yn115'><q id='yn115'><span id='yn115'><b id='yn115'><form id='yn115'><ins id='yn115'></ins><ul id='yn115'></ul><sub id='yn115'></sub></form><legend id='yn115'></legend><bdo id='yn115'><pre id='yn115'><center id='yn115'></center></pre></bdo></b><th id='yn115'></th></span></q></dt></tr></i><div id='yn115'><tfoot id='yn115'></tfoot><dl id='yn115'><fieldset id='yn115'></fieldset></dl></div>

                    <tfoot id='yn115'></tfoot>
                  • <legend id='yn115'><style id='yn115'><dir id='yn115'><q id='yn115'></q></dir></style></legend>

                      <small id='yn115'></small><noframes id='yn115'>

                      • <bdo id='yn115'></bdo><ul id='yn115'></ul>