The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Problem with Mail_mime

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

  1. nitaish

    nitaish Well-Known Member
    PartnerNOC

    Joined:
    Jan 6, 2006
    Messages:
    123
    Likes Received:
    1
    Trophy Points:
    18
    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?
     
  2. nitaish

    nitaish Well-Known Member
    PartnerNOC

    Joined:
    Jan 6, 2006
    Messages:
    123
    Likes Received:
    1
    Trophy Points:
    18
    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.
     
Loading...

Share This Page