相关疑难解决方法(0)

PHPMailer - SMTP ERROR:从我的服务器发送邮件时密码命令失败

我已经使用phpmailer()概念使用php脚本从我的共享服务器向用户发送邮件,但是根据phpmailer代码,即使我的脚本中的所有内容都正确,我也无法发送.

我的代码是这样的:

  $message = " This is testing message from my server";

  $mail = new PHPMailer(); // create a new object
  $mail->IsSMTP(); // enable SMTP
  $mail->Host = "smtp.gmail.com";
  $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
  $mail->SMTPAuth = true; // authentication enabled
  $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
  $mail->Port = 465; // or 587
  $mail->IsHTML(true);
  $mail->Username = "moorthi.mrk10@gmail.com"; // My gmail username
  $mail->Password = "************"; // My Gmail Password
  $mail->SetFrom("moorthi.mrk10@gmail.com"); …
Run Code Online (Sandbox Code Playgroud)

php email smtp phpmailer

52
推荐指数
5
解决办法
9万
查看次数

SMTP Connect()失败.消息未发送.Mailer错误:SMTP Connect()失败

我试图将邮件发送到gmail地址,但它继续收到此错误"SMTP - >错误:无法连接到服务器:连接超时(110)SMTP连接()失败.邮件未发送.Mailer错误:SMTP连接()失败了." 可能是什么问题呢?

        require 'class.phpmailer.php'; // path to the PHPMailer class
        require 'class.smtp.php';

            $mail = new PHPMailer();


            $mail->IsSMTP();  // telling the class to use SMTP
            $mail->SMTPDebug = 2;
            $mail->Mailer = "smtp";
            $mail->Host = "ssl://smtp.gmail.com";
            $mail->Port = 587;
            $mail->SMTPAuth = true; // turn on SMTP authentication
            $mail->Username = "myemail@gmail.com"; // SMTP username
            $mail->Password = "mypasswword"; // SMTP password 
            $Mail->Priority = 1;

            $mail->AddAddress("myemail@gmail.com","Name");
            $mail->SetFrom($visitor_email, $name);
            $mail->AddReplyTo($visitor_email,$name);

            $mail->Subject  = "Message from  Contact form";
            $mail->Body     = $user_message;
            $mail->WordWrap = 50;  

            if(!$mail->Send()) {
            echo …
Run Code Online (Sandbox Code Playgroud)

php email smtp

24
推荐指数
3
解决办法
11万
查看次数

使用GMail和phpMailer发送时"服务器不接受密码:535验证数据不正确"

我在localhost上运行相同的php脚本 - 我的PC与XAMPP和托管服务器上运行.它适用于我的PC,但不适用于托管服务器.

当我从托管服务器发送它时,我得到以下输出:

SMTP -> ERROR: Password not accepted from server: 535 Incorrect authentication data  
SMTP -> ERROR: RCPT not accepted from server: 550-Please turn on SMTP Authentication in your mail client, or login to the 550-IMAP/POP3 server before sending your message. dev.camppage.com 550-(patchvalues.com) [205.234.141.238]:50958 is not permitted to relay through 550 this server without authentication.  
SMTP Error: The following recipients failed: jdorner4@gmail.com FAILED
Run Code Online (Sandbox Code Playgroud)

我怀疑有一个配置设置需要在服务器上更改,但我不知道哪一个.任何建议将不胜感激!

这是代码:

function send_gmail ($recipients, $subject, $message, $attachment_filenames = array()) 
{
  global $email_address, $email_password, $email_name; …
Run Code Online (Sandbox Code Playgroud)

php gmail phpmailer

20
推荐指数
2
解决办法
4万
查看次数

PHP mail()函数在namecheap服务器中不起作用

我是namecheap域服务器的新手.我试图在该namecheap服务器上发送一个简单的邮件.它没有发送邮件并返回空值而不是任何错误.

这是我的示例代码.

$to = "raamanmca@gmail.com";
$subject = "HTML email";
$message = "Hello this is testing mail";

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// More headers
$headers .= 'From: <ramalingam@binaryswan.com>' . "\r\n";
$headers .= 'Cc: myboss@example.com' . "\r\n";

if(mail($to,$subject,$message,$headers))
{
    echo "Mail sent...";    
}
else
{
    echo "Mail not sent";   
}
Run Code Online (Sandbox Code Playgroud)

假设我在namecheap服务器邮件中分配$ to和$ from mailID,然后成功发送邮件.

例:

$to='test@binaryswan.com' 
$from='hello@binaryswan.com'
Run Code Online (Sandbox Code Playgroud)

但我正在将邮件$更改为OR $进入gmail服务器,就像test@gmail.com那时它不会发送邮件一样,也会返回空值而不会出错.怎么修.

从(不是从PHP邮件()方法接收电子邮件)只有在我们的服务器上托管域可以用在"发件人"字段.任何未托管我们的域都无法添加到"发件人"字段中.我们必须采取此措施来防止使用论坛,留言簿和联系表单脚本发送垃圾邮件.为使您的网站脚本正常工作,您应将"发件人"字段设置为已在cPanel中创建的电子邮件帐户.

它与我的问题,但我不知道如何"设置'发件人’字段在我的cPanel电子邮件帐户."

php

5
推荐指数
1
解决办法
3733
查看次数

PHPMailer SMTP错误:无法连接到服务器

<?php

include("class.phpmailer.php");
include("class.smtp.php");

$mail = new PHPMailer();

$mail->IsSMTP();  // telling the class to use SMTP
$mail->Mailer = "smtp";
$mail->SMTPDebug = 2;
$mail->Host = "ssl://smtp.gmail.com"; // specify main and backup server
$mail->Port = 587; // set the port to use
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPSecure = "tls";

$mail->Username = "123@gmail.com"; // SMTP username
$mail->Password = "password"; // SMTP password 

$mail->From = "123@gmail.com";
$mail->FromName = "Webmaster";

$mail->AddAddress("asd@hotmail.com");
$mail->AddReplyTo("123@gmail.com", "Webmaster");
$mail->IsHTML(true);

$mail->Subject  = "First PHPMailer Message";
$mail->Body     = "Hi! …
Run Code Online (Sandbox Code Playgroud)

php phpmailer

5
推荐指数
1
解决办法
4万
查看次数

Phpmailer使用smtp与Gmail无法正常工作 - 连接超时

我查看了以下链接:

phpmailer发送gmail smtp超时

通过PHP邮件程序使用Gmail SMTP服务器发送电子邮件

http://uly.me/phpmailer-and-gmail-smtp/

...并试图为自己实现这些的组合......但大多数时候它发送此消息......

无法发送消息.

邮件程序错误:SMTP连接()失败.

然而有一次,当我在"tls"和"ssl"之间进行实验时,它发送了这个...

SMTP错误:无法连接到服务器:连接超时(110)SMTP连接()失败.无法发送消息.

邮件程序错误:SMTP连接()失败.

我的代码附上了...我不知道错过了什么?我问网络托管服务是否阻止并给他们一个我的代码模板 - 他们说服务器允许连接到Gmail的SMTP.

    require_once("class.phpmailer.php");
    $mail = new PHPMailer();
    $mail -> IsSMTP();
    $mail -> SMTPDebug = 2;
    $mail -> SMTPAuth = 'true';
    $mail -> SMTPSecure = 'tls';
    $mail -> SMTPKeepAlive = true;
    $mail -> Host = 'smtp.gmail.com';
    $mail -> Port = 587;
    $mail -> IsHTML(true); 

    $mail -> Username = "myemail@gmail.com";
    $mail -> Password = "mypassword";
    $mail -> SingleTo = true; 

    $to = xxx;                           
    $from = xxx;
    $fromname = xxx; …
Run Code Online (Sandbox Code Playgroud)

php email ssl gmail phpmailer

4
推荐指数
1
解决办法
3万
查看次数

PHPMailer 没有使用正确的“发件人”地址发送

我正在使用链接到我的 gmail 帐户的 PHPMailer。

我需要自动加载器,创建一个函数来处理发送邮件,然后触发该函数进行测试。这一切看起来像这样:

require "PHPMailer/PHPMailerAutoload.php";

function sendMail($to, $subject, $body, $from){

  //init PHPMailer
  $mail = new PHPMailer;
  $mail->isSMTP();
  $mail->SMTPAuth = true;
  $mail->SMTPSecure = "tls";
  $mail->Port = 587;
  $mail->isHTML(true);

  //connection settings
  $mail->Host = "smtp.gmail.com";
  $mail->Username = "xxx@xxx.com";
  $mail->Password = "xxxxxxxx";

  //addresses
  $mail->addAddress($to);
  $mail->setFrom($from);

  //create email
  $mail->Subject = $subject;
  $mail->Body = $body;

  //send email
  $mail->send();
}

//sendMail(to, subject, body, from)
sendMail("xxxx@xxxxx.com", "Test Subject", "Test body", "xxxxx@xxxxx.com");
Run Code Online (Sandbox Code Playgroud)

这会将带有正确主题和正文的电子邮件发送到正确的位置,但它会忽略“发件人”地址,并且电子邮件总是说它来自传递电子邮件的 gmail 帐户。反正有没有配置这个工作?

请注意,我显然省略了上面代码中正确的帐户详细信息和真实的往来地址。

php email gmail smtp phpmailer

0
推荐指数
1
解决办法
4412
查看次数

标签 统计

php ×7

phpmailer ×5

email ×4

gmail ×3

smtp ×3

ssl ×1