PEAR Email function does not work in WP plugin

I am trying to set pear email in my wordpress plugin but the mail does not send. If i write php default mail() function it works perfectly. But i must use PEAR Mail function.

I put folder in plugin root and include mail file include("Mail/Mail.php"); in plugin index file and write mail function in another file.

Read More

Here is the pear mail code:

$host = "ssl://my smtp host";
         $port = "123";
         $username = "mail@info.com";
         $password = "*********";

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

         $mail = $smtp->send($payer_email, $headers, $message);

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

Note: I also try in xampp localhost to make a simple mail form and redirect to pear mail file, the mail goes successfully, but when i try this in plugin, mail not send.

Edit: Sorry to mention that i use this for paypal, when a user complete the payment method then confirm email send to buyer user …. but mail not send with PEAR::Mail

Any idea what is the problem

Related posts

Leave a Reply