Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Problem with Mail_mime

Discussion in 'E-mail Discussion' started by nitaish, Mar 6, 2009.

  1. nitaish

    nitaish Well-Known Member
    PartnerNOC

    Joined:
    Jan 6, 2006
    Messages:
    134
    Likes Received:
    2
    Trophy Points:
    168
    Location:
    Mulund, India, India
    One of our customers is facing a problem in his code. It throws the error

    Fatal error: Class 'Mail_mime' not found in /home/yashagn/public_html/mail_try1.php on line 9

    Here is the code


    <?php
    error_reporting(E_ALL);
    ini_set('display_errors', '1');

    require_once 'Mail.php';
    require_once('/usr/local/lib/php/Mail/mimePart.php');

    $message = new Mail_mime();

    $text = 'Hello this is the Plain email';
    $html = '<b>Hello</b><hr />This is the HTML email.';

    $message->setTXTBody($text);
    $message->setHTMLBody($html);

    $body = $message->get();

    $extraheaders = array('From' => 'me@example.com',
    'Subject' => 'Subject');

    $headers = $message->headers($extraheaders);
    $mail = Mail::factory('mail');
    $mail->send('you@example.com', $headers, $body);
    ?>

    Can anybody tell me what is wrong in the code?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. nitaish

    nitaish Well-Known Member
    PartnerNOC

    Joined:
    Jan 6, 2006
    Messages:
    134
    Likes Received:
    2
    Trophy Points:
    168
    Location:
    Mulund, India, India
    I could resolve the issue myself. I added the line /usr/local/lib/php/Mail/mime.php just above /usr/local/lib/php/Mail/mimePart.php and that resolved the issue.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice