php sendmail

if i wanted to use gmail

how would I change

logger -p mail.crit lx-sending mail for `id -un 2>/dev/null` > /dev/null 2>&1
export DKSIGN=/var/qmail/control/domainkeys/%/private
exec /var/qmail/bin/sendmail "$@"

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

To use an external mail server from with in PHP you will need to modify your php.ini file, specifically the [mail function] section. In that section you can specify the SMTP server you would like to use.
rgb192Author Commented:
so would i have to change the attached file
these days most linux servers have pear installed by default
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

rgb192Author Commented:
how could i see if pear is installed

and if it is,
where do i put my smtp info
write this to a php file

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

/* $path = "/usr/local/bin/pear";
set_include_path(get_include_path() . PATH_SEPARATOR . $path); */
require_once 'System.php';  
require_once 'PEAR.php';
require_once '/home/fhlinux195/o/';
/* require_once 'Mail.php';
var_dump(class_exists('Mail')); */
phpinfo ();
You can check if pear is installed by running this command: pear version

If pear is installed then you can use the attached code to test a SMTP service. If pear is not installed you will need to modify you php.ini file as stated previously.
  require_once "Mail.php";

  $from = "Firstname Lastname <>";
  $to = "Firstname Lastname <>";
  $subject = "Testing with Pear!";
  $body = "Hi,\n\nThis is a test email";
  $host = "ssl://";
  $port = "465";
  $username = "smtp_username";
  $password = "smtp_password";
  $headers = array ('From' => $from,'To' => $to,'Subject' => $subject);
  $smtp = Mail::factory('smtp',
    array ('host' => $host,
    'port' => $port,
    'auth' => true,
    'username' => $username,
    'password' => $password));
  $mail = $smtp->send($to, $headers, $body);

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

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
                       $pm=new phpmailer;
                        $pm->IsSMTP(); // telling the class to use SMTP
                        $pm->SMTPDebug  = 1;                     // enables SMTP debug information (for testing)
                        $pm->SMTPAuth   = true;                  // enable SMTP authentication
                        $pm->Host       = "ssl://"; // sets the SMTP server
                        $pm->Username   = ""; // SMTP account username
                        $pm->Password   = "dasdsad";        // SMTP account password
                        $pm->CharSet = 'UTF-8';
                        $pm->SetFrom(''); //must be same as account
                        //$pm->SetFrom($result['od'] . '@' . $result['domena'], $result['ime']);
                        $pm->Body = $result['vsebina'];
                        if (!$pm->Send()) {
                              echo 'FAILED!';
rgb192Author Commented:
pear version
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/' - cannot open shared object file: No such file or directory in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/' - cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  Module 'mcrypt' already loaded in Unknown on line 0

Warning: Module 'mcrypt' already loaded in Unknown on line 0
PEAR Version: 1.6.2
PHP Version: 5.2.1
Zend Engine Version: 2.2.0
Running on: Linux
Ok you obviously have some PHP errors to deal with. I would check that the .so files actually exist there. Aside from the errors, the test mail code I provided above should work. Did you try it? Did it work?
rgb192Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.