简体   繁体   English

无法使用 Godaddy 电子邮件凭据使用 PHP 发送邮件

[英]Unable to send mail using PHP using Godaddy email credentials

code:代码:

<?php
    try {
        require_once "Mail.php";
        require_once "Mail/mime.php";
        $from = "support@domain.com";
        $to = "user@gmail.com";
        $subject = "Testing email please ignore";
        $message = "Just testing";
        $host = "godaddyhost";
        $port = "465";
        $username = "support@domain.com";
        $password = "password";
        $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject);
        $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
        $mail = $smtp->send($to, $headers, $message); 
        if (PEAR::isError($mail)) { 
              echo("<p>" . $mail->getMessage() . "</p>");
        } else {
                echo("<p>Message successfully sent!</p>");
        }

    } catch(Exception $e) {
        echo $e;
    }
    ?>

I'm facing an issue in the browser on executing the above script我在执行上述script在浏览器中遇到问题

This page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500

If I comment my code from $mail = $smtp->send($to, $headers, $message);如果我从$mail = $smtp->send($to, $headers, $message);注释我的代码$mail = $smtp->send($to, $headers, $message); and just simply echo "something";只是简单地echo "something"; then I can see something on my browser然后我可以在浏览器上看到一些东西

Log日志

[Wed Dec 27 17:07:36.033665 2017] [:error] [pid 28115] [client ::1:41546] PHP Warning:  include_once(Net/SMTP.php): failed to open stream: No such file or directory in /usr/share/php/Mail/smtp.php on line 365
[Wed Dec 27 17:07:36.033715 2017] [:error] [pid 28115] [client ::1:41546] PHP Warning:  include_once(): Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/php/Mail/smtp.php on line 365
[Wed Dec 27 17:07:36.033741 2017] [:error] [pid 28115] [client ::1:41546] PHP Fatal error:  Class 'Net_SMTP' not found in /usr/share/php/Mail/smtp.php on line 366

Please install "Net/" classes.请安装“Net/”类。

Use this command on Linux machine, sudo pear install Net_SMTP OR在 Linux 机器上使用此命令, sudo pear install Net_SMTP

pear install Net_SMTP for windows machine. pear install Net_SMTP为 Windows 机器pear install Net_SMTP OR或者

downloaded the following, and put them in /Net下载以下内容,并将它们放入/Net

http://pear.php.net/package/Net_SMTP/download http://pear.php.net/package/Net_SMTP/download

http://pear.php.net/package/Net_Socket/download http://pear.php.net/package/Net_Socket/download

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法使用 PHP 邮件将数据从 HTML 表单发送到 email - Unable to send data from HTML form to email using PHP mail() 无法使用 PHP mail() 发送电子邮件。 您的服务器可能未配置为使用此方法发送邮件 - Unable to send email using PHP mail(). Your server might not be configured to send mail using this method 遇到错误无法使用 PHP mail() 发送 email。 您的服务器可能未配置为使用此方法发送邮件 - An Error Was Encountered Unable to send email using PHP mail(). Your server might not be configured to send mail using this method 无法使用php联络表格在Godaddy网络邮件上发送邮件 - Not able to send mail on Godaddy webmail using php contact form 无法使用php中的mail()函数发送邮件 - Unable to send mail using mail() function in php 如何使用PHP和angularjs将电子邮件发送到godaddy托管的emailid - how to send email to godaddy hosted emailid using PHP and angularjs 使用 PHP 或 PHPMailer 从 GoDaddy 服务器发送 email - Send email from GoDaddy Server using PHP or PHPMailer Codeigniter:您的服务器可能未配置为使用此方法发送邮件。 无法使用 PHP SMTP 发送电子邮件 - Codeigniter: Your server might not be configured to send mail using this method. Unable to send email using PHP SMTP 无法使用 PHP SMTP 发送电子邮件。 您的服务器可能未配置为使用此方法发送邮件 - Unable to send email using PHP SMTP. Your server might not be configured to send mail using this methods 无法使用 PHP SMTP 发送 email。您的服务器可能未配置为使用此方法发送邮件 - Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM