Follow

Install Pear & Mail (SSH)

Client needs to use it to send mail via SMTP in php. It is not present server wise, but you can manage pear packages trough ssh for their account, or just upload the libraries manually

In all of our SSH accounts, PEAR's "package manager" is now installed and all siters PHP.ini now have a default inclusion that means that no paths need to be corrected to quickly get started, for example. send email via SMTP in PHP.

Install PEAR + Mail

1. Start by logging in to your SSH account (The account creates you via "Files" -> "SSH" in your control panel).

2. Install PEAR on your account by running the following two commands:
pear config-create ~ / .pearrc
pear install -o PEAR

This creates a directory structure under the "pear" directory of your root level in your account where PHP will automatically search for installed packages, and new packages will also end after installation.

3. Then install the Mail package on your account with this command:
pear install pear / mail

Now the basic package for PEAR and the mail module are installed and it is great to directly include this directly in a PHP script such as sends a single mail with the following code:

<? Php
include ( 'mail.php');
$ headers ['From'] = 'test@servage.net';
$ headers ['To'] = 'test2@servage.net';
$ headers ['Subject'] = 'Test heading';
$ body = 'Test message';
$ params ['sendmail_path'] = '/usr/sbin/sendmail.postfix -t -i';
$ mail_object = & Mail :: factory ('sendmail', $ params);
$ mail_object-> send ($ recipients, $ headers, $ body);
?>

More information can be found directly on the pears web site and documentation, and above all, it is worth reading the part about installing and updating packages.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.