即使使用PHP

时间:2018-02-16 07:32:31

标签: php phpmailer

我面临一个问题。我使用class.phpmailer.php使用PHP发送电子邮件,但在代码中我收到了一些错误,如下所示。

致命错误:Class' PHPMailer'在第5行的/var/www/example.com/public_html/spesh/mobileapi/sendmymail.php中找不到

我在这里解释我的代码。

  

mobileapi / sendmymail.php:

<?php   
    error_reporting(E_ALL);
    ini_set('display_errors', '1');
    require_once 'class.phpmailer.php';
    $mail = new PHPMailer();
    echo 'hello';exit;
    /*$body='<!DOCTYPE html>
            <html lang="en">
            <head>
            <meta charset="utf-8">
            <title> HTML5 : Hello World Example</title>
            </head>
            <body>
            <h1>Hello World</h1>
            <p>
            Hey there!
            </p>
            </body>
            </html>';
    $mail->SetFrom('info@thespesh.com', 'Info The Spesh');
    $mail->AddReplyTo("info@thespesh.com","Info The Spesh");
    $mail->Subject    = "Sending Test Mail";
    $mail->MsgHTML($body);
    $address ='subhrajyotipradhan@gmail.com' ;
    $mail->AddAddress($address);
    if($mail->Send()) {
        echo "Success";
    } else {
        echo "Failed";
    }*/
?>

我在class.phpmailer.php目录中也有mobileapi个文件,但我仍然收到上述错误。在这里,我需要清除此错误并成功发送邮件。

0 个答案:

没有答案