It's for ADM <= v2.1.
At first you have to install from App Center the Optware ipkg.
After, enter the shell with root user and give the command:
Code: Select all
ipkg install msmtpCreate or edit the msmtp configuration file in the user’s home directory.
Remember that every user needs to send email must have it's own .msmtprc
Use vi editor:
Code: Select all
vi ~/.msmtprcCode: Select all
account yahoo
tls on
tls_starttls off
auth on
host smtp.mail.yahoo.com
user user
from user@yahoo.com
password ******
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account gmail
tls on
auth on
host smtp.gmail.com
port 587
user user@gmail.com
from user@gmail.com
password ******
tls_trust_file /etc/ssl/certs/ca-certificates.crtIf you're going to use a not listed provider, you've to find the authority certificate and add into the file /etc/ssl/certs/ca-certificates.crt
or another file to specify into the option tls_trust_file.
To protect passwords give read access only to the owner:
Code: Select all
chmod 600 ~/.msmtprcCode: Select all
vi test_emailCode: Select all
From: Bob <bob@example.com>
To: Jane <jane@domain.com>
Subject: Hello Jane
Test email sent with msmtpCode: Select all
cat test_email | msmtp -a yahoo jane@domain.comNow let's configure for use with PHP Mail() function.
Use vi to create the file:
Code: Select all
vi /volume0/usr/builtin/etc/php5/apache2/msmtprcProtect with right access:
Code: Select all
chmod 600 msmtprcfind with:
Code: Select all
ps -ef | grep apache2
 9916 root      0:00 /usr/builtin/sbin/apache2 -k start
 9918 admin      0:00 /usr/builtin/sbin/apache2 -k startCode: Select all
chown admin msmtprcCode: Select all
vi /volume0/usr/builtin/etc/php5/apache2/php.iniCode: Select all
sendmail_path = "/usr/bin/msmtp -C /etc/msmtprc -a yahoo -t"Code: Select all
<?php
   mail("jane@domain.com","Hello World","Email sent using PHP via msmtp");
?>