dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: Unable to find class for driver smtp

  1. #1
    Join Date
    Jan 2014
    Posts
    2

    Unable to find class for driver smtp

    Hello everyone cam anyone please help me to debug error "Unable to find class for driver smtp" on urgent basis.I am working with mail function in PHP , i am able to send mail when working in local machine but unable to send mail when working with our main server.

  2. #2
    Join Date
    Jan 2014
    Posts
    2
    //Here is my code
    <?php
    session_start();
    error_reporting( E_ALL & ~( E_NOTICE | E_STRICT | E_DEPRECATED ) );
    require_once "Mail.php";
    {
    $strName=$_SESSION['strName'];
    $callNumber= $_SESSION['callNumber'];
    $emailId= $_SESSION['emailId'];
    $from = $emailId;

    $to = "ABC <abc@gmail.com>";

    $subject = "web call from $strName";
    $body = "Hi,\n\n You got a call from $callNumber \n\n Name :$strName \n\n Email:$emailId.\n\n Please contact them as early as possible. \n\nRegards,\nWeb call team ";

    $host = "hostname.com";
    $username = "abc@xyz.com";
    $password = "password";
    $port = "x";

    $headers = array ('From' => $from,
    'To' => $to,
    'Subject' => $subject);
    $smtp =& Mail::factory('smtp',
    array ('host' => $host,
    'port' => $port,
    'auth' => true,
    'username' => $username,
    'password' => $password));

    $mail = Mail::factory('smtp',
    array ('host' => $host,
    'port' => $port,
    'auth' => true,
    'username' => $username,
    'password' => $password));

    if (PEAR::isError($mail)) {
    echo $mail->getMessage() . "\n" . $mail->getUserInfo() . "\n";
    die();
    }
    $mail->send($to, $headers, $body);

    $mail = $smtp->send($to, $headers, $body);


    if (PEAR::isError($mail)) {
    echo("<p>" . $mail->getMessage() . "</p>");
    } else {
    echo("<p>Message successfully sent!</p>");
    }
    }
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles